<!DOCTYPE html>
<html lang="" xml:lang="">
<head>

  <meta charset="utf-8" />
  <meta http-equiv="X-UA-Compatible" content="IE=edge" />
  <title>10.5 rmarkdown’s site generator | R Markdown 最佳指南</title>
  <meta name="description" content="The first official book authored by the core R Markdown developers that provides a comprehensive and accurate reference to the R Markdown ecosystem. With R Markdown, you can easily create reproducible data analysis reports, presentations, dashboards, interactive applications, books, dissertations, websites, and journal articles, while enjoying the simplicity of Markdown and the great power of R and other languages." />
  <meta name="generator" content="bookdown 0.18 and GitBook 2.6.7" />

  <meta property="og:title" content="10.5 rmarkdown’s site generator | R Markdown 最佳指南" />
  <meta property="og:type" content="book" />
  <meta property="og:url" content="https://bookdown.org/yihui/rmarkdown/" />
  <meta property="og:image" content="https://bookdown.org/yihui/rmarkdown/images/cover.png" />
  <meta property="og:description" content="The first official book authored by the core R Markdown developers that provides a comprehensive and accurate reference to the R Markdown ecosystem. With R Markdown, you can easily create reproducible data analysis reports, presentations, dashboards, interactive applications, books, dissertations, websites, and journal articles, while enjoying the simplicity of Markdown and the great power of R and other languages." />
  <meta name="github-repo" content="rstudio/rmarkdown-book" />

  <meta name="twitter:card" content="summary" />
  <meta name="twitter:title" content="10.5 rmarkdown’s site generator | R Markdown 最佳指南" />
  
  <meta name="twitter:description" content="The first official book authored by the core R Markdown developers that provides a comprehensive and accurate reference to the R Markdown ecosystem. With R Markdown, you can easily create reproducible data analysis reports, presentations, dashboards, interactive applications, books, dissertations, websites, and journal articles, while enjoying the simplicity of Markdown and the great power of R and other languages." />
  <meta name="twitter:image" content="https://bookdown.org/yihui/rmarkdown/images/cover.png" />

<meta name="author" content="Yihui Xie, J. J. Allaire, Garrett Grolemund（著）" />
<meta name="author" content="王诗翔（译）" />


<meta name="date" content="2020-06-02" />

  <meta name="viewport" content="width=device-width, initial-scale=1" />
  <meta name="apple-mobile-web-app-capable" content="yes" />
  <meta name="apple-mobile-web-app-status-bar-style" content="black" />
  
  
<link rel="prev" href="blogdown-other.html"/>
<link rel="next" href="pkgdown.html"/>
<script src="libs/jquery/jquery.min.js"></script>
<link href="libs/gitbook/css/style.css" rel="stylesheet" />
<link href="libs/gitbook/css/plugin-table.css" rel="stylesheet" />
<link href="libs/gitbook/css/plugin-bookdown.css" rel="stylesheet" />
<link href="libs/gitbook/css/plugin-highlight.css" rel="stylesheet" />
<link href="libs/gitbook/css/plugin-search.css" rel="stylesheet" />
<link href="libs/gitbook/css/plugin-fontsettings.css" rel="stylesheet" />
<link href="libs/gitbook/css/plugin-clipboard.css" rel="stylesheet" />









<script src="libs/htmlwidgets/htmlwidgets.js"></script>
<script src="libs/sigma/sigma.min.js"></script>
<script src="libs/sigma/plugins/sigma.parsers.gexf.min.js"></script>
<script src="libs/sigma-binding/sigma.js"></script>


<style type="text/css">
a.sourceLine { display: inline-block; line-height: 1.25; }
a.sourceLine { pointer-events: none; color: inherit; text-decoration: inherit; }
a.sourceLine:empty { height: 1.2em; }
.sourceCode { overflow: visible; }
code.sourceCode { white-space: pre; position: relative; }
pre.sourceCode { margin: 0; }
@media screen {
div.sourceCode { overflow: auto; }
}
@media print {
code.sourceCode { white-space: pre-wrap; }
a.sourceLine { text-indent: -1em; padding-left: 1em; }
}
pre.numberSource a.sourceLine
  { position: relative; left: -4em; }
pre.numberSource a.sourceLine::before
  { content: attr(data-line-number);
    position: relative; left: -1em; text-align: right; vertical-align: baseline;
    border: none; pointer-events: all; display: inline-block;
    -webkit-touch-callout: none; -webkit-user-select: none;
    -khtml-user-select: none; -moz-user-select: none;
    -ms-user-select: none; user-select: none;
    padding: 0 4px; width: 4em;
    color: #aaaaaa;
  }
pre.numberSource { margin-left: 3em; border-left: 1px solid #aaaaaa;  padding-left: 4px; }
div.sourceCode
  {  }
@media screen {
a.sourceLine::before { text-decoration: underline; }
}
code span.al { color: #ff0000; font-weight: bold; } /* Alert */
code span.an { color: #60a0b0; font-weight: bold; font-style: italic; } /* Annotation */
code span.at { color: #7d9029; } /* Attribute */
code span.bn { color: #40a070; } /* BaseN */
code span.bu { } /* BuiltIn */
code span.cf { color: #007020; font-weight: bold; } /* ControlFlow */
code span.ch { color: #4070a0; } /* Char */
code span.cn { color: #880000; } /* Constant */
code span.co { color: #60a0b0; font-style: italic; } /* Comment */
code span.cv { color: #60a0b0; font-weight: bold; font-style: italic; } /* CommentVar */
code span.do { color: #ba2121; font-style: italic; } /* Documentation */
code span.dt { color: #902000; } /* DataType */
code span.dv { color: #40a070; } /* DecVal */
code span.er { color: #ff0000; font-weight: bold; } /* Error */
code span.ex { } /* Extension */
code span.fl { color: #40a070; } /* Float */
code span.fu { color: #06287e; } /* Function */
code span.im { } /* Import */
code span.in { color: #60a0b0; font-weight: bold; font-style: italic; } /* Information */
code span.kw { color: #007020; font-weight: bold; } /* Keyword */
code span.op { color: #666666; } /* Operator */
code span.ot { color: #007020; } /* Other */
code span.pp { color: #bc7a00; } /* Preprocessor */
code span.sc { color: #4070a0; } /* SpecialChar */
code span.ss { color: #bb6688; } /* SpecialString */
code span.st { color: #4070a0; } /* String */
code span.va { color: #19177c; } /* Variable */
code span.vs { color: #4070a0; } /* VerbatimString */
code span.wa { color: #60a0b0; font-weight: bold; font-style: italic; } /* Warning */
</style>

<link rel="stylesheet" href="css/style.css" type="text/css" />
</head>

<body>



  <div class="book without-animation with-summary font-size-2 font-family-1" data-basepath=".">

    <div class="book-summary">
      <nav role="navigation">

<ul class="summary">
<li><a href="./">R Markdown: The Definitive Guide</a></li>

<li class="divider"></li>
<li class="chapter" data-level="" data-path="index.html"><a href="index.html"><i class="fa fa-check"></i>前言</a><ul>
<li class="chapter" data-level="" data-path="how-to-read-this-book.html"><a href="how-to-read-this-book.html"><i class="fa fa-check"></i>How to read this book</a></li>
<li class="chapter" data-level="" data-path="structure-of-the-book.html"><a href="structure-of-the-book.html"><i class="fa fa-check"></i>Structure of the book</a></li>
<li class="chapter" data-level="" data-path="software-info.html"><a href="software-info.html"><i class="fa fa-check"></i>Software information and conventions</a></li>
<li class="chapter" data-level="" data-path="acknowledgments.html"><a href="acknowledgments.html"><i class="fa fa-check"></i>Acknowledgments</a></li>
</ul></li>
<li class="chapter" data-level="" data-path="author.html"><a href="author.html"><i class="fa fa-check"></i>About the Authors</a><ul>
<li class="chapter" data-level="" data-path="yihui-xie.html"><a href="yihui-xie.html"><i class="fa fa-check"></i>Yihui Xie</a></li>
<li class="chapter" data-level="" data-path="j-j-allaire.html"><a href="j-j-allaire.html"><i class="fa fa-check"></i>J.J. Allaire</a></li>
<li class="chapter" data-level="" data-path="garrett-grolemund.html"><a href="garrett-grolemund.html"><i class="fa fa-check"></i>Garrett Grolemund</a></li>
</ul></li>
<li class="part"><span><b>I Get Started</b></span></li>
<li class="chapter" data-level="1" data-path="installation.html"><a href="installation.html"><i class="fa fa-check"></i><b>1</b> Installation</a></li>
<li class="chapter" data-level="2" data-path="basics.html"><a href="basics.html"><i class="fa fa-check"></i><b>2</b> Basics</a><ul>
<li class="chapter" data-level="2.1" data-path="basics-examples.html"><a href="basics-examples.html"><i class="fa fa-check"></i><b>2.1</b> Example applications</a><ul>
<li class="chapter" data-level="2.1.1" data-path="basics-examples.html"><a href="basics-examples.html#airbnbs-knowledge-repository"><i class="fa fa-check"></i><b>2.1.1</b> Airbnb’s knowledge repository</a></li>
<li class="chapter" data-level="2.1.2" data-path="basics-examples.html"><a href="basics-examples.html#homework-assignments-on-rpubs"><i class="fa fa-check"></i><b>2.1.2</b> Homework assignments on RPubs</a></li>
<li class="chapter" data-level="2.1.3" data-path="basics-examples.html"><a href="basics-examples.html#personalized-mail"><i class="fa fa-check"></i><b>2.1.3</b> Personalized mail</a></li>
<li class="chapter" data-level="2.1.4" data-path="basics-examples.html"><a href="basics-examples.html#employer-health-benefits-survey"><i class="fa fa-check"></i><b>2.1.4</b> 2017 Employer Health Benefits Survey</a></li>
<li class="chapter" data-level="2.1.5" data-path="basics-examples.html"><a href="basics-examples.html#examples-journal"><i class="fa fa-check"></i><b>2.1.5</b> Journal articles</a></li>
<li class="chapter" data-level="2.1.6" data-path="basics-examples.html"><a href="basics-examples.html#dashboards-at-eelloo"><i class="fa fa-check"></i><b>2.1.6</b> Dashboards at eelloo</a></li>
<li class="chapter" data-level="2.1.7" data-path="basics-examples.html"><a href="basics-examples.html#examples-books"><i class="fa fa-check"></i><b>2.1.7</b> Books</a></li>
<li class="chapter" data-level="2.1.8" data-path="basics-examples.html"><a href="basics-examples.html#examples-websites"><i class="fa fa-check"></i><b>2.1.8</b> Websites</a></li>
</ul></li>
<li class="chapter" data-level="2.2" data-path="compile.html"><a href="compile.html"><i class="fa fa-check"></i><b>2.2</b> Compile an R Markdown document</a></li>
<li class="chapter" data-level="2.3" data-path="cheat-sheets.html"><a href="cheat-sheets.html"><i class="fa fa-check"></i><b>2.3</b> Cheat sheets</a></li>
<li class="chapter" data-level="2.4" data-path="output-formats.html"><a href="output-formats.html"><i class="fa fa-check"></i><b>2.4</b> Output formats</a></li>
<li class="chapter" data-level="2.5" data-path="markdown-syntax.html"><a href="markdown-syntax.html"><i class="fa fa-check"></i><b>2.5</b> Markdown syntax</a><ul>
<li class="chapter" data-level="2.5.1" data-path="markdown-syntax.html"><a href="markdown-syntax.html#inline-formatting"><i class="fa fa-check"></i><b>2.5.1</b> Inline formatting</a></li>
<li class="chapter" data-level="2.5.2" data-path="markdown-syntax.html"><a href="markdown-syntax.html#block-level-elements"><i class="fa fa-check"></i><b>2.5.2</b> Block-level elements</a></li>
<li class="chapter" data-level="2.5.3" data-path="markdown-syntax.html"><a href="markdown-syntax.html#math-expressions"><i class="fa fa-check"></i><b>2.5.3</b> Math expressions</a></li>
</ul></li>
<li class="chapter" data-level="2.6" data-path="r-code.html"><a href="r-code.html"><i class="fa fa-check"></i><b>2.6</b> R code chunks and inline R code</a><ul>
<li class="chapter" data-level="2.6.1" data-path="r-code.html"><a href="r-code.html#figures"><i class="fa fa-check"></i><b>2.6.1</b> Figures</a></li>
<li class="chapter" data-level="2.6.2" data-path="r-code.html"><a href="r-code.html#tables"><i class="fa fa-check"></i><b>2.6.2</b> Tables</a></li>
</ul></li>
<li class="chapter" data-level="2.7" data-path="language-engines.html"><a href="language-engines.html"><i class="fa fa-check"></i><b>2.7</b> Other language engines</a><ul>
<li class="chapter" data-level="2.7.1" data-path="language-engines.html"><a href="language-engines.html#python"><i class="fa fa-check"></i><b>2.7.1</b> Python</a></li>
<li class="chapter" data-level="2.7.2" data-path="language-engines.html"><a href="language-engines.html#shell-scripts"><i class="fa fa-check"></i><b>2.7.2</b> Shell scripts</a></li>
<li class="chapter" data-level="2.7.3" data-path="language-engines.html"><a href="language-engines.html#sql"><i class="fa fa-check"></i><b>2.7.3</b> SQL</a></li>
<li class="chapter" data-level="2.7.4" data-path="language-engines.html"><a href="language-engines.html#rcpp"><i class="fa fa-check"></i><b>2.7.4</b> Rcpp</a></li>
<li class="chapter" data-level="2.7.5" data-path="language-engines.html"><a href="language-engines.html#stan"><i class="fa fa-check"></i><b>2.7.5</b> Stan</a></li>
<li class="chapter" data-level="2.7.6" data-path="language-engines.html"><a href="language-engines.html#javascript-and-css"><i class="fa fa-check"></i><b>2.7.6</b> JavaScript and CSS</a></li>
<li class="chapter" data-level="2.7.7" data-path="language-engines.html"><a href="language-engines.html#julia"><i class="fa fa-check"></i><b>2.7.7</b> Julia</a></li>
<li class="chapter" data-level="2.7.8" data-path="language-engines.html"><a href="language-engines.html#c-and-fortran"><i class="fa fa-check"></i><b>2.7.8</b> C and Fortran</a></li>
</ul></li>
<li class="chapter" data-level="2.8" data-path="interactive-documents.html"><a href="interactive-documents.html"><i class="fa fa-check"></i><b>2.8</b> Interactive documents</a><ul>
<li class="chapter" data-level="2.8.1" data-path="interactive-documents.html"><a href="interactive-documents.html#intro-widgets"><i class="fa fa-check"></i><b>2.8.1</b> HTML widgets</a></li>
<li class="chapter" data-level="2.8.2" data-path="interactive-documents.html"><a href="interactive-documents.html#intro-shiny"><i class="fa fa-check"></i><b>2.8.2</b> Shiny documents</a></li>
</ul></li>
</ul></li>
<li class="part"><span><b>II Output Formats</b></span></li>
<li class="chapter" data-level="3" data-path="documents.html"><a href="documents.html"><i class="fa fa-check"></i><b>3</b> Documents</a><ul>
<li class="chapter" data-level="3.1" data-path="html-document.html"><a href="html-document.html"><i class="fa fa-check"></i><b>3.1</b> HTML document</a><ul>
<li class="chapter" data-level="3.1.1" data-path="html-document.html"><a href="html-document.html#table-of-contents"><i class="fa fa-check"></i><b>3.1.1</b> Table of contents</a></li>
<li class="chapter" data-level="3.1.2" data-path="html-document.html"><a href="html-document.html#section-numbering"><i class="fa fa-check"></i><b>3.1.2</b> Section numbering</a></li>
<li class="chapter" data-level="3.1.3" data-path="html-document.html"><a href="html-document.html#tabbed-sections"><i class="fa fa-check"></i><b>3.1.3</b> Tabbed sections</a></li>
<li class="chapter" data-level="3.1.4" data-path="html-document.html"><a href="html-document.html#appearance-and-style"><i class="fa fa-check"></i><b>3.1.4</b> Appearance and style</a></li>
<li class="chapter" data-level="3.1.5" data-path="html-document.html"><a href="html-document.html#figure-options"><i class="fa fa-check"></i><b>3.1.5</b> Figure options</a></li>
<li class="chapter" data-level="3.1.6" data-path="html-document.html"><a href="html-document.html#data-frame-printing"><i class="fa fa-check"></i><b>3.1.6</b> Data frame printing</a></li>
<li class="chapter" data-level="3.1.7" data-path="html-document.html"><a href="html-document.html#code-folding"><i class="fa fa-check"></i><b>3.1.7</b> Code folding</a></li>
<li class="chapter" data-level="3.1.8" data-path="html-document.html"><a href="html-document.html#mathjax-equations"><i class="fa fa-check"></i><b>3.1.8</b> MathJax equations</a></li>
<li class="chapter" data-level="3.1.9" data-path="html-document.html"><a href="html-document.html#document-dependencies"><i class="fa fa-check"></i><b>3.1.9</b> Document dependencies</a></li>
<li class="chapter" data-level="3.1.10" data-path="html-document.html"><a href="html-document.html#advanced-customization"><i class="fa fa-check"></i><b>3.1.10</b> Advanced customization</a></li>
<li class="chapter" data-level="3.1.11" data-path="html-document.html"><a href="html-document.html#shared-options"><i class="fa fa-check"></i><b>3.1.11</b> Shared options</a></li>
<li class="chapter" data-level="3.1.12" data-path="html-document.html"><a href="html-document.html#html-fragments"><i class="fa fa-check"></i><b>3.1.12</b> HTML fragments</a></li>
</ul></li>
<li class="chapter" data-level="3.2" data-path="notebook.html"><a href="notebook.html"><i class="fa fa-check"></i><b>3.2</b> Notebook</a><ul>
<li class="chapter" data-level="3.2.1" data-path="notebook.html"><a href="notebook.html#using-notebooks"><i class="fa fa-check"></i><b>3.2.1</b> Using Notebooks</a></li>
<li class="chapter" data-level="3.2.2" data-path="notebook.html"><a href="notebook.html#saving-and-sharing"><i class="fa fa-check"></i><b>3.2.2</b> Saving and sharing</a></li>
<li class="chapter" data-level="3.2.3" data-path="notebook.html"><a href="notebook.html#notebook-format"><i class="fa fa-check"></i><b>3.2.3</b> Notebook format</a></li>
</ul></li>
<li class="chapter" data-level="3.3" data-path="pdf-document.html"><a href="pdf-document.html"><i class="fa fa-check"></i><b>3.3</b> PDF document</a><ul>
<li class="chapter" data-level="3.3.1" data-path="pdf-document.html"><a href="pdf-document.html#table-of-contents-1"><i class="fa fa-check"></i><b>3.3.1</b> Table of contents</a></li>
<li class="chapter" data-level="3.3.2" data-path="pdf-document.html"><a href="pdf-document.html#figure-options-1"><i class="fa fa-check"></i><b>3.3.2</b> Figure options</a></li>
<li class="chapter" data-level="3.3.3" data-path="pdf-document.html"><a href="pdf-document.html#data-frame-printing-1"><i class="fa fa-check"></i><b>3.3.3</b> Data frame printing</a></li>
<li class="chapter" data-level="3.3.4" data-path="pdf-document.html"><a href="pdf-document.html#syntax-highlighting"><i class="fa fa-check"></i><b>3.3.4</b> Syntax highlighting</a></li>
<li class="chapter" data-level="3.3.5" data-path="pdf-document.html"><a href="pdf-document.html#latex-options"><i class="fa fa-check"></i><b>3.3.5</b> LaTeX options</a></li>
<li class="chapter" data-level="3.3.6" data-path="pdf-document.html"><a href="pdf-document.html#latex-packages-for-citations"><i class="fa fa-check"></i><b>3.3.6</b> LaTeX packages for citations</a></li>
<li class="chapter" data-level="3.3.7" data-path="pdf-document.html"><a href="pdf-document.html#advanced-customization-1"><i class="fa fa-check"></i><b>3.3.7</b> Advanced customization</a></li>
<li class="chapter" data-level="3.3.8" data-path="pdf-document.html"><a href="pdf-document.html#other-features"><i class="fa fa-check"></i><b>3.3.8</b> Other features</a></li>
</ul></li>
<li class="chapter" data-level="3.4" data-path="word-document.html"><a href="word-document.html"><i class="fa fa-check"></i><b>3.4</b> Word document</a><ul>
<li class="chapter" data-level="3.4.1" data-path="word-document.html"><a href="word-document.html#other-features-1"><i class="fa fa-check"></i><b>3.4.1</b> Other features</a></li>
</ul></li>
<li class="chapter" data-level="3.5" data-path="opendocument-text-document.html"><a href="opendocument-text-document.html"><i class="fa fa-check"></i><b>3.5</b> OpenDocument Text document</a><ul>
<li class="chapter" data-level="3.5.1" data-path="opendocument-text-document.html"><a href="opendocument-text-document.html#other-features-2"><i class="fa fa-check"></i><b>3.5.1</b> Other features</a></li>
</ul></li>
<li class="chapter" data-level="3.6" data-path="rich-text-format-document.html"><a href="rich-text-format-document.html"><i class="fa fa-check"></i><b>3.6</b> Rich Text Format document</a><ul>
<li class="chapter" data-level="3.6.1" data-path="rich-text-format-document.html"><a href="rich-text-format-document.html#other-features-3"><i class="fa fa-check"></i><b>3.6.1</b> Other features</a></li>
</ul></li>
<li class="chapter" data-level="3.7" data-path="markdown-document.html"><a href="markdown-document.html"><i class="fa fa-check"></i><b>3.7</b> Markdown document</a><ul>
<li class="chapter" data-level="3.7.1" data-path="markdown-document.html"><a href="markdown-document.html#markdown-variants"><i class="fa fa-check"></i><b>3.7.1</b> Markdown variants</a></li>
<li class="chapter" data-level="3.7.2" data-path="markdown-document.html"><a href="markdown-document.html#other-features-4"><i class="fa fa-check"></i><b>3.7.2</b> Other features</a></li>
</ul></li>
<li class="chapter" data-level="3.8" data-path="r-package-vignette.html"><a href="r-package-vignette.html"><i class="fa fa-check"></i><b>3.8</b> R package vignette</a></li>
</ul></li>
<li class="chapter" data-level="4" data-path="presentations.html"><a href="presentations.html"><i class="fa fa-check"></i><b>4</b> Presentations</a><ul>
<li class="chapter" data-level="4.1" data-path="ioslides-presentation.html"><a href="ioslides-presentation.html"><i class="fa fa-check"></i><b>4.1</b> ioslides presentation</a><ul>
<li class="chapter" data-level="4.1.1" data-path="ioslides-presentation.html"><a href="ioslides-presentation.html#display-modes"><i class="fa fa-check"></i><b>4.1.1</b> Display modes</a></li>
<li class="chapter" data-level="4.1.2" data-path="ioslides-presentation.html"><a href="ioslides-presentation.html#incremental-bullets"><i class="fa fa-check"></i><b>4.1.2</b> Incremental bullets</a></li>
<li class="chapter" data-level="4.1.3" data-path="ioslides-presentation.html"><a href="ioslides-presentation.html#visual-appearance"><i class="fa fa-check"></i><b>4.1.3</b> Visual appearance</a></li>
<li class="chapter" data-level="4.1.4" data-path="ioslides-presentation.html"><a href="ioslides-presentation.html#code-highlighting"><i class="fa fa-check"></i><b>4.1.4</b> Code highlighting</a></li>
<li class="chapter" data-level="4.1.5" data-path="ioslides-presentation.html"><a href="ioslides-presentation.html#adding-a-logo"><i class="fa fa-check"></i><b>4.1.5</b> Adding a logo</a></li>
<li class="chapter" data-level="4.1.6" data-path="ioslides-presentation.html"><a href="ioslides-presentation.html#tables-1"><i class="fa fa-check"></i><b>4.1.6</b> Tables</a></li>
<li class="chapter" data-level="4.1.7" data-path="ioslides-presentation.html"><a href="ioslides-presentation.html#advanced-layout"><i class="fa fa-check"></i><b>4.1.7</b> Advanced layout</a></li>
<li class="chapter" data-level="4.1.8" data-path="ioslides-presentation.html"><a href="ioslides-presentation.html#text-color"><i class="fa fa-check"></i><b>4.1.8</b> Text color</a></li>
<li class="chapter" data-level="4.1.9" data-path="ioslides-presentation.html"><a href="ioslides-presentation.html#presenter-mode"><i class="fa fa-check"></i><b>4.1.9</b> Presenter mode</a></li>
<li class="chapter" data-level="4.1.10" data-path="ioslides-presentation.html"><a href="ioslides-presentation.html#printing-and-pdf-output"><i class="fa fa-check"></i><b>4.1.10</b> Printing and PDF output</a></li>
<li class="chapter" data-level="4.1.11" data-path="ioslides-presentation.html"><a href="ioslides-presentation.html#custom-templates-2"><i class="fa fa-check"></i><b>4.1.11</b> Custom templates</a></li>
<li class="chapter" data-level="4.1.12" data-path="ioslides-presentation.html"><a href="ioslides-presentation.html#other-features-5"><i class="fa fa-check"></i><b>4.1.12</b> Other features</a></li>
</ul></li>
<li class="chapter" data-level="4.2" data-path="slidy-presentation.html"><a href="slidy-presentation.html"><i class="fa fa-check"></i><b>4.2</b> Slidy presentation</a><ul>
<li class="chapter" data-level="4.2.1" data-path="slidy-presentation.html"><a href="slidy-presentation.html#display-modes-1"><i class="fa fa-check"></i><b>4.2.1</b> Display modes</a></li>
<li class="chapter" data-level="4.2.2" data-path="slidy-presentation.html"><a href="slidy-presentation.html#text-size"><i class="fa fa-check"></i><b>4.2.2</b> Text size</a></li>
<li class="chapter" data-level="4.2.3" data-path="slidy-presentation.html"><a href="slidy-presentation.html#footer-elements"><i class="fa fa-check"></i><b>4.2.3</b> Footer elements</a></li>
<li class="chapter" data-level="4.2.4" data-path="slidy-presentation.html"><a href="slidy-presentation.html#other-features-6"><i class="fa fa-check"></i><b>4.2.4</b> Other features</a></li>
</ul></li>
<li class="chapter" data-level="4.3" data-path="beamer-presentation.html"><a href="beamer-presentation.html"><i class="fa fa-check"></i><b>4.3</b> Beamer presentation</a><ul>
<li class="chapter" data-level="4.3.1" data-path="beamer-presentation.html"><a href="beamer-presentation.html#themes"><i class="fa fa-check"></i><b>4.3.1</b> Themes</a></li>
<li class="chapter" data-level="4.3.2" data-path="beamer-presentation.html"><a href="beamer-presentation.html#slide-level"><i class="fa fa-check"></i><b>4.3.2</b> Slide level</a></li>
<li class="chapter" data-level="4.3.3" data-path="beamer-presentation.html"><a href="beamer-presentation.html#other-features-7"><i class="fa fa-check"></i><b>4.3.3</b> Other features</a></li>
</ul></li>
<li class="chapter" data-level="4.4" data-path="powerpoint-presentation.html"><a href="powerpoint-presentation.html"><i class="fa fa-check"></i><b>4.4</b> PowerPoint presentation</a><ul>
<li class="chapter" data-level="4.4.1" data-path="powerpoint-presentation.html"><a href="powerpoint-presentation.html#ppt-templates"><i class="fa fa-check"></i><b>4.4.1</b> Custom templates</a></li>
<li class="chapter" data-level="4.4.2" data-path="powerpoint-presentation.html"><a href="powerpoint-presentation.html#other-features-8"><i class="fa fa-check"></i><b>4.4.2</b> Other features</a></li>
</ul></li>
</ul></li>
<li class="part"><span><b>III Extensions</b></span></li>
<li class="chapter" data-level="5" data-path="dashboards.html"><a href="dashboards.html"><i class="fa fa-check"></i><b>5</b> Dashboards</a><ul>
<li class="chapter" data-level="5.1" data-path="layout.html"><a href="layout.html"><i class="fa fa-check"></i><b>5.1</b> Layout</a><ul>
<li class="chapter" data-level="5.1.1" data-path="layout.html"><a href="layout.html#row-based-layouts"><i class="fa fa-check"></i><b>5.1.1</b> Row-based layouts</a></li>
<li class="chapter" data-level="5.1.2" data-path="layout.html"><a href="layout.html#attributes-on-sections"><i class="fa fa-check"></i><b>5.1.2</b> Attributes on sections</a></li>
<li class="chapter" data-level="5.1.3" data-path="layout.html"><a href="layout.html#multiple-pages"><i class="fa fa-check"></i><b>5.1.3</b> Multiple pages</a></li>
<li class="chapter" data-level="5.1.4" data-path="layout.html"><a href="layout.html#story-boards"><i class="fa fa-check"></i><b>5.1.4</b> Story boards</a></li>
</ul></li>
<li class="chapter" data-level="5.2" data-path="dashboard-components.html"><a href="dashboard-components.html"><i class="fa fa-check"></i><b>5.2</b> Components</a><ul>
<li class="chapter" data-level="5.2.1" data-path="dashboard-components.html"><a href="dashboard-components.html#value-boxes"><i class="fa fa-check"></i><b>5.2.1</b> Value boxes</a></li>
<li class="chapter" data-level="5.2.2" data-path="dashboard-components.html"><a href="dashboard-components.html#gauges"><i class="fa fa-check"></i><b>5.2.2</b> Gauges</a></li>
<li class="chapter" data-level="5.2.3" data-path="dashboard-components.html"><a href="dashboard-components.html#text-annotations"><i class="fa fa-check"></i><b>5.2.3</b> Text annotations</a></li>
<li class="chapter" data-level="5.2.4" data-path="dashboard-components.html"><a href="dashboard-components.html#navigation-bar"><i class="fa fa-check"></i><b>5.2.4</b> Navigation bar</a></li>
</ul></li>
<li class="chapter" data-level="5.3" data-path="shiny.html"><a href="shiny.html"><i class="fa fa-check"></i><b>5.3</b> Shiny</a><ul>
<li class="chapter" data-level="5.3.1" data-path="shiny.html"><a href="shiny.html#getting-started"><i class="fa fa-check"></i><b>5.3.1</b> Getting started</a></li>
<li class="chapter" data-level="5.3.2" data-path="shiny.html"><a href="shiny.html#a-shiny-dashboard-example"><i class="fa fa-check"></i><b>5.3.2</b> A Shiny dashboard example</a></li>
<li class="chapter" data-level="5.3.3" data-path="shiny.html"><a href="shiny.html#input-sidebar"><i class="fa fa-check"></i><b>5.3.3</b> Input sidebar</a></li>
<li class="chapter" data-level="5.3.4" data-path="shiny.html"><a href="shiny.html#learning-more"><i class="fa fa-check"></i><b>5.3.4</b> Learning more</a></li>
</ul></li>
</ul></li>
<li class="chapter" data-level="6" data-path="tufte-handouts.html"><a href="tufte-handouts.html"><i class="fa fa-check"></i><b>6</b> Tufte Handouts</a><ul>
<li class="chapter" data-level="6.1" data-path="tufte-headings.html"><a href="tufte-headings.html"><i class="fa fa-check"></i><b>6.1</b> Headings</a></li>
<li class="chapter" data-level="6.2" data-path="tufte-figures.html"><a href="tufte-figures.html"><i class="fa fa-check"></i><b>6.2</b> Figures</a><ul>
<li class="chapter" data-level="6.2.1" data-path="tufte-figures.html"><a href="tufte-figures.html#margin-figures"><i class="fa fa-check"></i><b>6.2.1</b> Margin figures</a></li>
<li class="chapter" data-level="6.2.2" data-path="tufte-figures.html"><a href="tufte-figures.html#arbitrary-margin-content"><i class="fa fa-check"></i><b>6.2.2</b> Arbitrary margin content</a></li>
<li class="chapter" data-level="6.2.3" data-path="tufte-figures.html"><a href="tufte-figures.html#full-width-figures"><i class="fa fa-check"></i><b>6.2.3</b> Full-width figures</a></li>
<li class="chapter" data-level="6.2.4" data-path="tufte-figures.html"><a href="tufte-figures.html#main-column-figures"><i class="fa fa-check"></i><b>6.2.4</b> Main column figures</a></li>
</ul></li>
<li class="chapter" data-level="6.3" data-path="tufte-sidenotes.html"><a href="tufte-sidenotes.html"><i class="fa fa-check"></i><b>6.3</b> Sidenotes</a></li>
<li class="chapter" data-level="6.4" data-path="tufte-references.html"><a href="tufte-references.html"><i class="fa fa-check"></i><b>6.4</b> References</a></li>
<li class="chapter" data-level="6.5" data-path="tufte-tables.html"><a href="tufte-tables.html"><i class="fa fa-check"></i><b>6.5</b> Tables</a></li>
<li class="chapter" data-level="6.6" data-path="tufte-quotes.html"><a href="tufte-quotes.html"><i class="fa fa-check"></i><b>6.6</b> Block quotes</a></li>
<li class="chapter" data-level="6.7" data-path="tufte-responsiveness.html"><a href="tufte-responsiveness.html"><i class="fa fa-check"></i><b>6.7</b> Responsiveness</a></li>
<li class="chapter" data-level="6.8" data-path="tufte-sans.html"><a href="tufte-sans.html"><i class="fa fa-check"></i><b>6.8</b> Sans-serif fonts and epigraphs</a></li>
<li class="chapter" data-level="6.9" data-path="tufte-css.html"><a href="tufte-css.html"><i class="fa fa-check"></i><b>6.9</b> Customize CSS styles</a></li>
</ul></li>
<li class="chapter" data-level="7" data-path="xaringan.html"><a href="xaringan.html"><i class="fa fa-check"></i><b>7</b> xaringan Presentations</a><ul>
<li class="chapter" data-level="7.1" data-path="xaringan-start.html"><a href="xaringan-start.html"><i class="fa fa-check"></i><b>7.1</b> Get started</a></li>
<li class="chapter" data-level="7.2" data-path="xaringan-key.html"><a href="xaringan-key.html"><i class="fa fa-check"></i><b>7.2</b> Keyboard shortcuts</a></li>
<li class="chapter" data-level="7.3" data-path="xaringan-format.html"><a href="xaringan-format.html"><i class="fa fa-check"></i><b>7.3</b> Slide formatting</a><ul>
<li class="chapter" data-level="7.3.1" data-path="xaringan-format.html"><a href="xaringan-format.html#slides-and-properties"><i class="fa fa-check"></i><b>7.3.1</b> Slides and properties</a></li>
<li class="chapter" data-level="7.3.2" data-path="xaringan-format.html"><a href="xaringan-format.html#the-title-slide"><i class="fa fa-check"></i><b>7.3.2</b> The title slide</a></li>
<li class="chapter" data-level="7.3.3" data-path="xaringan-format.html"><a href="xaringan-format.html#content-classes"><i class="fa fa-check"></i><b>7.3.3</b> Content classes</a></li>
<li class="chapter" data-level="7.3.4" data-path="xaringan-format.html"><a href="xaringan-format.html#incremental-slides"><i class="fa fa-check"></i><b>7.3.4</b> Incremental slides</a></li>
<li class="chapter" data-level="7.3.5" data-path="xaringan-format.html"><a href="xaringan-format.html#xaringan-notes"><i class="fa fa-check"></i><b>7.3.5</b> Presenter notes</a></li>
<li class="chapter" data-level="7.3.6" data-path="xaringan-format.html"><a href="xaringan-format.html#yolo-true"><i class="fa fa-check"></i><b>7.3.6</b> yolo: true</a></li>
</ul></li>
<li class="chapter" data-level="7.4" data-path="xaringan-preview.html"><a href="xaringan-preview.html"><i class="fa fa-check"></i><b>7.4</b> Build and preview slides</a></li>
<li class="chapter" data-level="7.5" data-path="css-and-themes.html"><a href="css-and-themes.html"><i class="fa fa-check"></i><b>7.5</b> CSS and themes</a></li>
<li class="chapter" data-level="7.6" data-path="some-tips.html"><a href="some-tips.html"><i class="fa fa-check"></i><b>7.6</b> Some tips</a><ul>
<li class="chapter" data-level="7.6.1" data-path="some-tips.html"><a href="some-tips.html#autoplay-slides"><i class="fa fa-check"></i><b>7.6.1</b> Autoplay slides</a></li>
<li class="chapter" data-level="7.6.2" data-path="some-tips.html"><a href="some-tips.html#countdown-timer"><i class="fa fa-check"></i><b>7.6.2</b> Countdown timer</a></li>
<li class="chapter" data-level="7.6.3" data-path="some-tips.html"><a href="some-tips.html#highlight-code-lines"><i class="fa fa-check"></i><b>7.6.3</b> Highlight code lines</a></li>
<li class="chapter" data-level="7.6.4" data-path="some-tips.html"><a href="some-tips.html#working-offline"><i class="fa fa-check"></i><b>7.6.4</b> Working offline</a></li>
<li class="chapter" data-level="7.6.5" data-path="some-tips.html"><a href="some-tips.html#macros"><i class="fa fa-check"></i><b>7.6.5</b> Macros</a></li>
<li class="chapter" data-level="7.6.6" data-path="some-tips.html"><a href="some-tips.html#disadvantages"><i class="fa fa-check"></i><b>7.6.6</b> Disadvantages</a></li>
</ul></li>
</ul></li>
<li class="chapter" data-level="8" data-path="revealjs.html"><a href="revealjs.html"><i class="fa fa-check"></i><b>8</b> reveal.js Presentations</a><ul>
<li class="chapter" data-level="8.1" data-path="display-modes-2.html"><a href="display-modes-2.html"><i class="fa fa-check"></i><b>8.1</b> Display modes</a></li>
<li class="chapter" data-level="8.2" data-path="appearance-and-style-1.html"><a href="appearance-and-style-1.html"><i class="fa fa-check"></i><b>8.2</b> Appearance and style</a><ul>
<li class="chapter" data-level="8.2.1" data-path="appearance-and-style-1.html"><a href="appearance-and-style-1.html#smaller-text"><i class="fa fa-check"></i><b>8.2.1</b> Smaller text</a></li>
</ul></li>
<li class="chapter" data-level="8.3" data-path="slide-transitions.html"><a href="slide-transitions.html"><i class="fa fa-check"></i><b>8.3</b> Slide transitions</a></li>
<li class="chapter" data-level="8.4" data-path="slide-backgrounds.html"><a href="slide-backgrounds.html"><i class="fa fa-check"></i><b>8.4</b> Slide backgrounds</a></li>
<li class="chapter" data-level="8.5" data-path="d-presentations.html"><a href="d-presentations.html"><i class="fa fa-check"></i><b>8.5</b> 2-D presentations</a></li>
<li class="chapter" data-level="8.6" data-path="custom-css-1.html"><a href="custom-css-1.html"><i class="fa fa-check"></i><b>8.6</b> Custom CSS</a><ul>
<li class="chapter" data-level="8.6.1" data-path="custom-css-1.html"><a href="custom-css-1.html#slide-ids-and-classes"><i class="fa fa-check"></i><b>8.6.1</b> Slide IDs and classes</a></li>
<li class="chapter" data-level="8.6.2" data-path="custom-css-1.html"><a href="custom-css-1.html#styling-text-spans"><i class="fa fa-check"></i><b>8.6.2</b> Styling text spans</a></li>
</ul></li>
<li class="chapter" data-level="8.7" data-path="reveal-js-options.html"><a href="reveal-js-options.html"><i class="fa fa-check"></i><b>8.7</b> reveal.js options</a></li>
<li class="chapter" data-level="8.8" data-path="reveal-js-plugins.html"><a href="reveal-js-plugins.html"><i class="fa fa-check"></i><b>8.8</b> reveal.js plugins</a></li>
<li class="chapter" data-level="8.9" data-path="other-features-9.html"><a href="other-features-9.html"><i class="fa fa-check"></i><b>8.9</b> Other features</a></li>
</ul></li>
<li class="chapter" data-level="9" data-path="community.html"><a href="community.html"><i class="fa fa-check"></i><b>9</b> Community Formats</a><ul>
<li class="chapter" data-level="9.1" data-path="prettydoc.html"><a href="prettydoc.html"><i class="fa fa-check"></i><b>9.1</b> Lightweight Pretty HTML Documents</a><ul>
<li class="chapter" data-level="9.1.1" data-path="prettydoc.html"><a href="prettydoc.html#prettydoc-usage"><i class="fa fa-check"></i><b>9.1.1</b> Usage</a></li>
<li class="chapter" data-level="9.1.2" data-path="prettydoc.html"><a href="prettydoc.html#prettydoc-vignettes"><i class="fa fa-check"></i><b>9.1.2</b> Package vignettes</a></li>
</ul></li>
<li class="chapter" data-level="9.2" data-path="rmdformats.html"><a href="rmdformats.html"><i class="fa fa-check"></i><b>9.2</b> The rmdformats package</a></li>
<li class="chapter" data-level="9.3" data-path="shower-presentations.html"><a href="shower-presentations.html"><i class="fa fa-check"></i><b>9.3</b> Shower presentations</a></li>
</ul></li>
<li class="chapter" data-level="10" data-path="websites.html"><a href="websites.html"><i class="fa fa-check"></i><b>10</b> Websites</a><ul>
<li class="chapter" data-level="10.1" data-path="blogdown-start.html"><a href="blogdown-start.html"><i class="fa fa-check"></i><b>10.1</b> Get started</a></li>
<li class="chapter" data-level="10.2" data-path="blogdown-directory.html"><a href="blogdown-directory.html"><i class="fa fa-check"></i><b>10.2</b> The directory structure</a></li>
<li class="chapter" data-level="10.3" data-path="blogdown-deploy.html"><a href="blogdown-deploy.html"><i class="fa fa-check"></i><b>10.3</b> Deployment</a></li>
<li class="chapter" data-level="10.4" data-path="blogdown-other.html"><a href="blogdown-other.html"><i class="fa fa-check"></i><b>10.4</b> Other site generators</a></li>
<li class="chapter" data-level="10.5" data-path="rmarkdown-site.html"><a href="rmarkdown-site.html"><i class="fa fa-check"></i><b>10.5</b> rmarkdown’s site generator</a><ul>
<li class="chapter" data-level="10.5.1" data-path="rmarkdown-site.html"><a href="rmarkdown-site.html#a-simple-example"><i class="fa fa-check"></i><b>10.5.1</b> A simple example</a></li>
<li class="chapter" data-level="10.5.2" data-path="rmarkdown-site.html"><a href="rmarkdown-site.html#site-authoring"><i class="fa fa-check"></i><b>10.5.2</b> Site authoring</a></li>
<li class="chapter" data-level="10.5.3" data-path="rmarkdown-site.html"><a href="rmarkdown-site.html#common-elements"><i class="fa fa-check"></i><b>10.5.3</b> Common elements</a></li>
<li class="chapter" data-level="10.5.4" data-path="rmarkdown-site.html"><a href="rmarkdown-site.html#site-navigation"><i class="fa fa-check"></i><b>10.5.4</b> Site navigation</a></li>
<li class="chapter" data-level="10.5.5" data-path="rmarkdown-site.html"><a href="rmarkdown-site.html#html-generation"><i class="fa fa-check"></i><b>10.5.5</b> HTML generation</a></li>
<li class="chapter" data-level="10.5.6" data-path="rmarkdown-site.html"><a href="rmarkdown-site.html#site-configuration"><i class="fa fa-check"></i><b>10.5.6</b> Site configuration</a></li>
<li class="chapter" data-level="10.5.7" data-path="rmarkdown-site.html"><a href="rmarkdown-site.html#publishing-websites"><i class="fa fa-check"></i><b>10.5.7</b> Publishing websites</a></li>
<li class="chapter" data-level="10.5.8" data-path="rmarkdown-site.html"><a href="rmarkdown-site.html#additional-examples"><i class="fa fa-check"></i><b>10.5.8</b> Additional examples</a></li>
<li class="chapter" data-level="10.5.9" data-path="rmarkdown-site.html"><a href="rmarkdown-site.html#custom-site-generators"><i class="fa fa-check"></i><b>10.5.9</b> Custom site generators</a></li>
</ul></li>
</ul></li>
<li class="chapter" data-level="11" data-path="pkgdown.html"><a href="pkgdown.html"><i class="fa fa-check"></i><b>11</b> HTML Documentation for R Packages</a><ul>
<li class="chapter" data-level="11.1" data-path="pkgdown-start.html"><a href="pkgdown-start.html"><i class="fa fa-check"></i><b>11.1</b> Get started</a></li>
<li class="chapter" data-level="11.2" data-path="pkgdown-components.html"><a href="pkgdown-components.html"><i class="fa fa-check"></i><b>11.2</b> Components</a><ul>
<li class="chapter" data-level="11.2.1" data-path="pkgdown-components.html"><a href="pkgdown-components.html#home-page"><i class="fa fa-check"></i><b>11.2.1</b> Home page</a></li>
<li class="chapter" data-level="11.2.2" data-path="pkgdown-components.html"><a href="pkgdown-components.html#function-reference"><i class="fa fa-check"></i><b>11.2.2</b> Function reference</a></li>
<li class="chapter" data-level="11.2.3" data-path="pkgdown-components.html"><a href="pkgdown-components.html#articles"><i class="fa fa-check"></i><b>11.2.3</b> Articles</a></li>
<li class="chapter" data-level="11.2.4" data-path="pkgdown-components.html"><a href="pkgdown-components.html#news"><i class="fa fa-check"></i><b>11.2.4</b> News</a></li>
<li class="chapter" data-level="11.2.5" data-path="pkgdown-components.html"><a href="pkgdown-components.html#navigation-bar-1"><i class="fa fa-check"></i><b>11.2.5</b> Navigation bar</a></li>
</ul></li>
</ul></li>
<li class="chapter" data-level="12" data-path="books.html"><a href="books.html"><i class="fa fa-check"></i><b>12</b> Books</a><ul>
<li class="chapter" data-level="12.1" data-path="bookdown-start.html"><a href="bookdown-start.html"><i class="fa fa-check"></i><b>12.1</b> Get started</a></li>
<li class="chapter" data-level="12.2" data-path="bookdown-project.html"><a href="bookdown-project.html"><i class="fa fa-check"></i><b>12.2</b> Project structure</a><ul>
<li class="chapter" data-level="12.2.1" data-path="bookdown-project.html"><a href="bookdown-project.html#index-file"><i class="fa fa-check"></i><b>12.2.1</b> Index file</a></li>
<li class="chapter" data-level="12.2.2" data-path="bookdown-project.html"><a href="bookdown-project.html#rmd-files"><i class="fa fa-check"></i><b>12.2.2</b> Rmd files</a></li>
<li class="chapter" data-level="12.2.3" data-path="bookdown-project.html"><a href="bookdown-project.html#bookdown.yml"><i class="fa fa-check"></i><b>12.2.3</b> <code>_bookdown.yml</code></a></li>
<li class="chapter" data-level="12.2.4" data-path="bookdown-project.html"><a href="bookdown-project.html#output.yml"><i class="fa fa-check"></i><b>12.2.4</b> <code>_output.yml</code></a></li>
</ul></li>
<li class="chapter" data-level="12.3" data-path="bookdown-markdown.html"><a href="bookdown-markdown.html"><i class="fa fa-check"></i><b>12.3</b> Markdown extensions</a><ul>
<li class="chapter" data-level="12.3.1" data-path="bookdown-markdown.html"><a href="bookdown-markdown.html#equations"><i class="fa fa-check"></i><b>12.3.1</b> Number and reference equations</a></li>
<li class="chapter" data-level="12.3.2" data-path="bookdown-markdown.html"><a href="bookdown-markdown.html#theorems"><i class="fa fa-check"></i><b>12.3.2</b> Theorems and proofs</a></li>
<li class="chapter" data-level="12.3.3" data-path="bookdown-markdown.html"><a href="bookdown-markdown.html#special-headers"><i class="fa fa-check"></i><b>12.3.3</b> Special headers</a></li>
<li class="chapter" data-level="12.3.4" data-path="bookdown-markdown.html"><a href="bookdown-markdown.html#text-references"><i class="fa fa-check"></i><b>12.3.4</b> Text references</a></li>
<li class="chapter" data-level="12.3.5" data-path="bookdown-markdown.html"><a href="bookdown-markdown.html#cross-referencing"><i class="fa fa-check"></i><b>12.3.5</b> Cross referencing</a></li>
</ul></li>
<li class="chapter" data-level="12.4" data-path="bookdown-output.html"><a href="bookdown-output.html"><i class="fa fa-check"></i><b>12.4</b> Output Formats</a><ul>
<li class="chapter" data-level="12.4.1" data-path="bookdown-output.html"><a href="bookdown-output.html#html"><i class="fa fa-check"></i><b>12.4.1</b> HTML</a></li>
<li class="chapter" data-level="12.4.2" data-path="bookdown-output.html"><a href="bookdown-output.html#latexpdf"><i class="fa fa-check"></i><b>12.4.2</b> LaTeX/PDF</a></li>
<li class="chapter" data-level="12.4.3" data-path="bookdown-output.html"><a href="bookdown-output.html#e-books"><i class="fa fa-check"></i><b>12.4.3</b> E-books</a></li>
<li class="chapter" data-level="12.4.4" data-path="bookdown-output.html"><a href="bookdown-output.html#a-single-document"><i class="fa fa-check"></i><b>12.4.4</b> A single document</a></li>
</ul></li>
<li class="chapter" data-level="12.5" data-path="bookdown-edit.html"><a href="bookdown-edit.html"><i class="fa fa-check"></i><b>12.5</b> Editing</a><ul>
<li class="chapter" data-level="12.5.1" data-path="bookdown-edit.html"><a href="bookdown-edit.html#build-the-book"><i class="fa fa-check"></i><b>12.5.1</b> Build the book</a></li>
<li class="chapter" data-level="12.5.2" data-path="bookdown-edit.html"><a href="bookdown-edit.html#preview-a-chapter"><i class="fa fa-check"></i><b>12.5.2</b> Preview a chapter</a></li>
<li class="chapter" data-level="12.5.3" data-path="bookdown-edit.html"><a href="bookdown-edit.html#serve-the-book"><i class="fa fa-check"></i><b>12.5.3</b> Serve the book</a></li>
<li class="chapter" data-level="12.5.4" data-path="bookdown-edit.html"><a href="bookdown-edit.html#rstudio-addins"><i class="fa fa-check"></i><b>12.5.4</b> RStudio addins</a></li>
</ul></li>
<li class="chapter" data-level="12.6" data-path="bookdown-publish.html"><a href="bookdown-publish.html"><i class="fa fa-check"></i><b>12.6</b> Publishing</a><ul>
<li class="chapter" data-level="12.6.1" data-path="bookdown-publish.html"><a href="bookdown-publish.html#rstudio-connect"><i class="fa fa-check"></i><b>12.6.1</b> RStudio Connect</a></li>
<li class="chapter" data-level="12.6.2" data-path="bookdown-publish.html"><a href="bookdown-publish.html#other-services"><i class="fa fa-check"></i><b>12.6.2</b> Other services</a></li>
<li class="chapter" data-level="12.6.3" data-path="bookdown-publish.html"><a href="bookdown-publish.html#publishers"><i class="fa fa-check"></i><b>12.6.3</b> Publishers</a></li>
</ul></li>
</ul></li>
<li class="chapter" data-level="13" data-path="journals.html"><a href="journals.html"><i class="fa fa-check"></i><b>13</b> Journals</a><ul>
<li class="chapter" data-level="13.1" data-path="rticles-start.html"><a href="rticles-start.html"><i class="fa fa-check"></i><b>13.1</b> Get started</a></li>
<li class="chapter" data-level="13.2" data-path="rticles-templates.html"><a href="rticles-templates.html"><i class="fa fa-check"></i><b>13.2</b> rticles templates</a></li>
<li class="chapter" data-level="13.3" data-path="rticles-usage.html"><a href="rticles-usage.html"><i class="fa fa-check"></i><b>13.3</b> Using a template</a></li>
<li class="chapter" data-level="13.4" data-path="rticles-latex.html"><a href="rticles-latex.html"><i class="fa fa-check"></i><b>13.4</b> LaTeX content</a></li>
<li class="chapter" data-level="13.5" data-path="rticles-bookdown.html"><a href="rticles-bookdown.html"><i class="fa fa-check"></i><b>13.5</b> Linking with bookdown</a></li>
<li class="chapter" data-level="13.6" data-path="rticles-contrib.html"><a href="rticles-contrib.html"><i class="fa fa-check"></i><b>13.6</b> Contributing templates</a></li>
</ul></li>
<li class="chapter" data-level="14" data-path="learnr.html"><a href="learnr.html"><i class="fa fa-check"></i><b>14</b> Interactive Tutorials</a><ul>
<li class="chapter" data-level="14.1" data-path="learnr-start.html"><a href="learnr-start.html"><i class="fa fa-check"></i><b>14.1</b> Get started</a></li>
<li class="chapter" data-level="14.2" data-path="learnr-types.html"><a href="learnr-types.html"><i class="fa fa-check"></i><b>14.2</b> Tutorial types</a></li>
<li class="chapter" data-level="14.3" data-path="learnr-exercises.html"><a href="learnr-exercises.html"><i class="fa fa-check"></i><b>14.3</b> Exercises</a><ul>
<li class="chapter" data-level="14.3.1" data-path="learnr-exercises.html"><a href="learnr-exercises.html#solutions"><i class="fa fa-check"></i><b>14.3.1</b> Solutions</a></li>
<li class="chapter" data-level="14.3.2" data-path="learnr-exercises.html"><a href="learnr-exercises.html#hints"><i class="fa fa-check"></i><b>14.3.2</b> Hints</a></li>
</ul></li>
<li class="chapter" data-level="14.4" data-path="learnr-quiz.html"><a href="learnr-quiz.html"><i class="fa fa-check"></i><b>14.4</b> Quiz questions</a></li>
<li class="chapter" data-level="14.5" data-path="learnr-videos.html"><a href="learnr-videos.html"><i class="fa fa-check"></i><b>14.5</b> Videos</a></li>
<li class="chapter" data-level="14.6" data-path="learnr-shiny.html"><a href="learnr-shiny.html"><i class="fa fa-check"></i><b>14.6</b> Shiny components</a></li>
<li class="chapter" data-level="14.7" data-path="learnr-nav.html"><a href="learnr-nav.html"><i class="fa fa-check"></i><b>14.7</b> Navigation and progress tracking</a></li>
</ul></li>
<li class="part"><span><b>IV Other Topics</b></span></li>
<li class="chapter" data-level="15" data-path="parameterized-reports.html"><a href="parameterized-reports.html"><i class="fa fa-check"></i><b>15</b> Parameterized reports</a><ul>
<li class="chapter" data-level="15.1" data-path="params-declare.html"><a href="params-declare.html"><i class="fa fa-check"></i><b>15.1</b> Declaring parameters</a></li>
<li class="chapter" data-level="15.2" data-path="params-use.html"><a href="params-use.html"><i class="fa fa-check"></i><b>15.2</b> Using parameters</a></li>
<li class="chapter" data-level="15.3" data-path="params-knit.html"><a href="params-knit.html"><i class="fa fa-check"></i><b>15.3</b> Knitting with parameters</a><ul>
<li class="chapter" data-level="15.3.1" data-path="params-knit.html"><a href="params-knit.html#the-knit-button"><i class="fa fa-check"></i><b>15.3.1</b> The <code>Knit</code> button</a></li>
<li class="chapter" data-level="15.3.2" data-path="params-knit.html"><a href="params-knit.html#knit-with-custom-parameters"><i class="fa fa-check"></i><b>15.3.2</b> Knit with custom parameters</a></li>
<li class="chapter" data-level="15.3.3" data-path="params-knit.html"><a href="params-knit.html#the-interactive-user-interface"><i class="fa fa-check"></i><b>15.3.3</b> The interactive user interface</a></li>
</ul></li>
<li class="chapter" data-level="15.4" data-path="params-publish.html"><a href="params-publish.html"><i class="fa fa-check"></i><b>15.4</b> Publishing</a></li>
</ul></li>
<li class="chapter" data-level="16" data-path="html-widgets.html"><a href="html-widgets.html"><i class="fa fa-check"></i><b>16</b> HTML Widgets</a><ul>
<li class="chapter" data-level="16.1" data-path="htmlwidgets-overview.html"><a href="htmlwidgets-overview.html"><i class="fa fa-check"></i><b>16.1</b> Overview</a></li>
<li class="chapter" data-level="16.2" data-path="htmlwidgets-sigma.html"><a href="htmlwidgets-sigma.html"><i class="fa fa-check"></i><b>16.2</b> A widget example (sigma.js)</a><ul>
<li class="chapter" data-level="16.2.1" data-path="htmlwidgets-sigma.html"><a href="htmlwidgets-sigma.html#file-layout"><i class="fa fa-check"></i><b>16.2.1</b> File layout</a></li>
<li class="chapter" data-level="16.2.2" data-path="htmlwidgets-sigma.html"><a href="htmlwidgets-sigma.html#dependencies"><i class="fa fa-check"></i><b>16.2.2</b> Dependencies</a></li>
<li class="chapter" data-level="16.2.3" data-path="htmlwidgets-sigma.html"><a href="htmlwidgets-sigma.html#r-binding"><i class="fa fa-check"></i><b>16.2.3</b> R binding</a></li>
<li class="chapter" data-level="16.2.4" data-path="htmlwidgets-sigma.html"><a href="htmlwidgets-sigma.html#javascript-binding"><i class="fa fa-check"></i><b>16.2.4</b> JavaScript binding</a></li>
<li class="chapter" data-level="16.2.5" data-path="htmlwidgets-sigma.html"><a href="htmlwidgets-sigma.html#demo"><i class="fa fa-check"></i><b>16.2.5</b> Demo</a></li>
</ul></li>
<li class="chapter" data-level="16.3" data-path="htmlwidgets-create.html"><a href="htmlwidgets-create.html"><i class="fa fa-check"></i><b>16.3</b> Creating your own widgets</a><ul>
<li class="chapter" data-level="16.3.1" data-path="htmlwidgets-create.html"><a href="htmlwidgets-create.html#requirements"><i class="fa fa-check"></i><b>16.3.1</b> Requirements</a></li>
<li class="chapter" data-level="16.3.2" data-path="htmlwidgets-create.html"><a href="htmlwidgets-create.html#scaffolding"><i class="fa fa-check"></i><b>16.3.2</b> Scaffolding</a></li>
<li class="chapter" data-level="16.3.3" data-path="htmlwidgets-create.html"><a href="htmlwidgets-create.html#other-packages"><i class="fa fa-check"></i><b>16.3.3</b> Other packages</a></li>
</ul></li>
<li class="chapter" data-level="16.4" data-path="htmlwidgets-size.html"><a href="htmlwidgets-size.html"><i class="fa fa-check"></i><b>16.4</b> Widget sizing</a><ul>
<li class="chapter" data-level="16.4.1" data-path="htmlwidgets-size.html"><a href="htmlwidgets-size.html#specifying-a-sizing-policy"><i class="fa fa-check"></i><b>16.4.1</b> Specifying a sizing policy</a></li>
<li class="chapter" data-level="16.4.2" data-path="htmlwidgets-size.html"><a href="htmlwidgets-size.html#javascript-resize-method"><i class="fa fa-check"></i><b>16.4.2</b> JavaScript resize method</a></li>
</ul></li>
<li class="chapter" data-level="16.5" data-path="htmlwidgets-advanced.html"><a href="htmlwidgets-advanced.html"><i class="fa fa-check"></i><b>16.5</b> Advanced topics</a><ul>
<li class="chapter" data-level="16.5.1" data-path="htmlwidgets-advanced.html"><a href="htmlwidgets-advanced.html#data-transformation"><i class="fa fa-check"></i><b>16.5.1</b> Data transformation</a></li>
<li class="chapter" data-level="16.5.2" data-path="htmlwidgets-advanced.html"><a href="htmlwidgets-advanced.html#passing-javascript-functions"><i class="fa fa-check"></i><b>16.5.2</b> Passing JavaScript functions</a></li>
<li class="chapter" data-level="16.5.3" data-path="htmlwidgets-advanced.html"><a href="htmlwidgets-advanced.html#custom-widget-html"><i class="fa fa-check"></i><b>16.5.3</b> Custom widget HTML</a></li>
<li class="chapter" data-level="16.5.4" data-path="htmlwidgets-advanced.html"><a href="htmlwidgets-advanced.html#create-a-widget-without-an-r-package"><i class="fa fa-check"></i><b>16.5.4</b> Create a widget without an R package</a></li>
</ul></li>
</ul></li>
<li class="chapter" data-level="17" data-path="document-templates.html"><a href="document-templates.html"><i class="fa fa-check"></i><b>17</b> Document Templates</a><ul>
<li class="chapter" data-level="17.1" data-path="template-structure.html"><a href="template-structure.html"><i class="fa fa-check"></i><b>17.1</b> Template structure</a></li>
<li class="chapter" data-level="17.2" data-path="template-support.html"><a href="template-support.html"><i class="fa fa-check"></i><b>17.2</b> Supporting files</a></li>
<li class="chapter" data-level="17.3" data-path="template-pandoc.html"><a href="template-pandoc.html"><i class="fa fa-check"></i><b>17.3</b> Custom Pandoc templates</a></li>
<li class="chapter" data-level="17.4" data-path="template-share.html"><a href="template-share.html"><i class="fa fa-check"></i><b>17.4</b> Sharing your templates</a></li>
</ul></li>
<li class="chapter" data-level="18" data-path="new-formats.html"><a href="new-formats.html"><i class="fa fa-check"></i><b>18</b> Creating New Formats</a><ul>
<li class="chapter" data-level="18.1" data-path="format-derive.html"><a href="format-derive.html"><i class="fa fa-check"></i><b>18.1</b> Deriving from built-in formats</a></li>
<li class="chapter" data-level="18.2" data-path="format-custom.html"><a href="format-custom.html"><i class="fa fa-check"></i><b>18.2</b> Fully custom formats</a></li>
<li class="chapter" data-level="18.3" data-path="format-use.html"><a href="format-use.html"><i class="fa fa-check"></i><b>18.3</b> Using a new format</a></li>
</ul></li>
<li class="chapter" data-level="19" data-path="shiny-documents.html"><a href="shiny-documents.html"><i class="fa fa-check"></i><b>19</b> Shiny Documents</a><ul>
<li class="chapter" data-level="19.1" data-path="shiny-start.html"><a href="shiny-start.html"><i class="fa fa-check"></i><b>19.1</b> Getting started</a></li>
<li class="chapter" data-level="19.2" data-path="shiny-deploy.html"><a href="shiny-deploy.html"><i class="fa fa-check"></i><b>19.2</b> Deployment</a><ul>
<li class="chapter" data-level="19.2.1" data-path="shiny-deploy.html"><a href="shiny-deploy.html#shinyapps.io"><i class="fa fa-check"></i><b>19.2.1</b> ShinyApps.io</a></li>
<li class="chapter" data-level="19.2.2" data-path="shiny-deploy.html"><a href="shiny-deploy.html#shiny-server-rstudio-connect"><i class="fa fa-check"></i><b>19.2.2</b> Shiny Server / RStudio Connect</a></li>
</ul></li>
<li class="chapter" data-level="19.3" data-path="shiny-embedded.html"><a href="shiny-embedded.html"><i class="fa fa-check"></i><b>19.3</b> Embedded Shiny apps</a><ul>
<li class="chapter" data-level="19.3.1" data-path="shiny-embedded.html"><a href="shiny-embedded.html#shiny-embed-inline"><i class="fa fa-check"></i><b>19.3.1</b> Inline applications</a></li>
<li class="chapter" data-level="19.3.2" data-path="shiny-embedded.html"><a href="shiny-embedded.html#external-applications"><i class="fa fa-check"></i><b>19.3.2</b> External applications</a></li>
</ul></li>
<li class="chapter" data-level="19.4" data-path="shiny-widgets.html"><a href="shiny-widgets.html"><i class="fa fa-check"></i><b>19.4</b> Shiny widgets</a><ul>
<li class="chapter" data-level="19.4.1" data-path="shiny-widgets.html"><a href="shiny-widgets.html#the-shinyapp-function"><i class="fa fa-check"></i><b>19.4.1</b> The <code>shinyApp()</code> function</a></li>
<li class="chapter" data-level="19.4.2" data-path="shiny-widgets.html"><a href="shiny-widgets.html#example-k-means-clustering"><i class="fa fa-check"></i><b>19.4.2</b> Example: k-Means clustering</a></li>
<li class="chapter" data-level="19.4.3" data-path="shiny-widgets.html"><a href="shiny-widgets.html#widget-size-and-layout"><i class="fa fa-check"></i><b>19.4.3</b> Widget size and layout</a></li>
</ul></li>
<li class="chapter" data-level="19.5" data-path="shiny-multiple.html"><a href="shiny-multiple.html"><i class="fa fa-check"></i><b>19.5</b> Multiple pages</a></li>
<li class="chapter" data-level="19.6" data-path="shiny-delay.html"><a href="shiny-delay.html"><i class="fa fa-check"></i><b>19.6</b> Delayed rendering</a></li>
<li class="chapter" data-level="19.7" data-path="shiny-args.html"><a href="shiny-args.html"><i class="fa fa-check"></i><b>19.7</b> Output arguments for render functions</a><ul>
<li class="chapter" data-level="19.7.1" data-path="shiny-args.html"><a href="shiny-args.html#a-caveat"><i class="fa fa-check"></i><b>19.7.1</b> A caveat</a></li>
</ul></li>
</ul></li>
<li class="chapter" data-level="" data-path="references.html"><a href="references.html"><i class="fa fa-check"></i>References</a></li>
<li class="divider"></li>
<li><a href="https://bookdown.org" target="_blank">Published with bookdown</a></li>

</ul>

      </nav>
    </div>

    <div class="book-body">
      <div class="body-inner">
        <div class="book-header" role="navigation">
          <h1>
            <i class="fa fa-circle-o-notch fa-spin"></i><a href="./">R Markdown 最佳指南</a>
          </h1>
        </div>

        <div class="page-wrapper" tabindex="-1" role="main">
          <div class="page-inner">

            <section class="normal" id="section-">
<div id="rmarkdown-site" class="section level2">
<h2><span class="header-section-number">10.5</span> rmarkdown’s site generator</h2>
<p>Before <strong>blogdown</strong> was invented, the <strong>rmarkdown</strong> package had provided a simple site generator that did not rely on a third-party site generator like Hugo. If you feel Hugo is too complex for you, and you only want to build a few Rmd documents into a website, this built-in site generator may be a good choice. A main restriction of this site generator is that it assumes all Rmd documents are under a flat directory (i.e., no pages under subdirectories). It also has fewer features compared to Hugo (e.g., no RSS feeds).</p>
<p>You can render collections of R Markdown documents as a website using the <code>rmarkdown::render_site()</code> function. We will call such websites “R Markdown websites” in this section. The RStudio IDE (version 1.0 or higher) also includes integrated support for developing R Markdown websites.</p>
<div id="a-simple-example" class="section level3">
<h3><span class="header-section-number">10.5.1</span> A simple example</h3>
<p>To start with, let’s walk through a very simple example, a website that includes two pages (<code>Home</code> and <code>About</code>) and a navigation bar to switch between them.</p>
<p>First, we need a configuration file <code>_site.yml</code>:</p>
<div class="sourceCode" id="cb245"><pre class="sourceCode yaml"><code class="sourceCode yaml"><a class="sourceLine" id="cb245-1" data-line-number="1"><span class="fu">name:</span><span class="at"> </span><span class="st">&quot;my-website&quot;</span></a>
<a class="sourceLine" id="cb245-2" data-line-number="2"><span class="fu">navbar:</span></a>
<a class="sourceLine" id="cb245-3" data-line-number="3">  <span class="fu">title:</span><span class="at"> </span><span class="st">&quot;My Website&quot;</span></a>
<a class="sourceLine" id="cb245-4" data-line-number="4">  <span class="fu">left:</span></a>
<a class="sourceLine" id="cb245-5" data-line-number="5">    <span class="kw">-</span> <span class="fu">text:</span><span class="at"> </span><span class="st">&quot;Home&quot;</span></a>
<a class="sourceLine" id="cb245-6" data-line-number="6">      <span class="fu">href:</span><span class="at"> index.html</span></a>
<a class="sourceLine" id="cb245-7" data-line-number="7">    <span class="kw">-</span> <span class="fu">text:</span><span class="at"> </span><span class="st">&quot;About&quot;</span></a>
<a class="sourceLine" id="cb245-8" data-line-number="8">      <span class="fu">href:</span><span class="at"> about.html</span></a></code></pre></div>
<p>Then two Rmd files, <code>index.Rmd</code>:</p>
<div class="sourceCode" id="cb246"><pre class="sourceCode markdown"><code class="sourceCode markdown"><a class="sourceLine" id="cb246-1" data-line-number="1">---</a>
<a class="sourceLine" id="cb246-2" data-line-number="2">title: &quot;My Website&quot;</a>
<a class="sourceLine" id="cb246-3" data-line-number="3">---</a>
<a class="sourceLine" id="cb246-4" data-line-number="4"></a>
<a class="sourceLine" id="cb246-5" data-line-number="5">Hello, Website!</a></code></pre></div>
<p>and <code>about.Rmd</code>:</p>
<div class="sourceCode" id="cb247"><pre class="sourceCode markdown"><code class="sourceCode markdown"><a class="sourceLine" id="cb247-1" data-line-number="1">---</a>
<a class="sourceLine" id="cb247-2" data-line-number="2">title: &quot;About This Website&quot;</a>
<a class="sourceLine" id="cb247-3" data-line-number="3">---</a>
<a class="sourceLine" id="cb247-4" data-line-number="4"></a>
<a class="sourceLine" id="cb247-5" data-line-number="5">More about this website.</a></code></pre></div>
<p>Note that the minimum requirement for any R Markdown website is that it have an <code>index.Rmd</code> file as well as a <code>_site.yml</code> file. If you execute the <code>rmarkdown::render_site()</code> function from within the directory containing the website, the following will occur:</p>
<ol style="list-style-type: decimal">
<li><p>All of the <code>*.Rmd</code> and <code>*.md</code> files in the root website directory will be rendered into HTML. Note, however, that Markdown files beginning with <code>_</code> are not rendered (this is a convention to designate files that are to be included by top level Rmd documents as child documents).</p></li>
<li><p>The generated HTML files and any supporting files (e.g., CSS and JavaScript) are copied into an output directory (<code>_site</code> by default).</p></li>
</ol>
<p>The HTML files within the <code>_site</code> directory are now ready to deploy as a standalone static website.</p>
<p>The full source code for the simple example above can be found in the <code>hello-website</code> folder in the repository <a href="https://github.com/rstudio/rmarkdown-website-examples" class="uri">https://github.com/rstudio/rmarkdown-website-examples</a>.</p>
</div>
<div id="site-authoring" class="section level3">
<h3><span class="header-section-number">10.5.2</span> Site authoring</h3>
<div id="rstudio" class="section level4">
<h4><span class="header-section-number">10.5.2.1</span> RStudio</h4>
<p>RStudio includes a variety of features intended to make developing R Markdown websites more productive.</p>
<p>All of the RStudio features for website authoring described below require the use of an RStudio Project tied to your website’s directory. See the documentation on <a href="https://support.rstudio.com/hc/en-us/articles/200526207-Using-Projects">RStudio Projects</a> for additional information on how to create and use projects.</p>
<p>As you work on the individual pages of your website, you can render them using the <code>Knit</code> button just as you do with conventional standalone R Markdown documents (see Figure <a href="rmarkdown-site.html#fig:site-page">10.1</a>).</p>
<div class="figure"><span id="fig:site-page"></span>
<img src="images/site-page.png" alt="Knit a single page of a website." width="100%" />
<p class="caption">
图 10.1: Knit a single page of a website.
</p>
</div>
<p>Knitting an individual page will only render and preview that page, not the other pages in the website.</p>
<p>To render all of the pages in the website, you use the <code>Build</code> pane, which calls <code>rmarkdown::render_site()</code> to build and then preview the entire site (see Figure <a href="rmarkdown-site.html#fig:site-build">10.2</a>).</p>
<div class="figure"><span id="fig:site-build"></span>
<img src="images/site-build.png" alt="Build an entire website in RStudio." width="100%" />
<p class="caption">
图 10.2: Build an entire website in RStudio.
</p>
</div>
<p>RStudio supports “live preview” of changes that you make to supporting files within your website (e.g., CSS, JavaScript, Rmd partials, R scripts, and YAML config files).</p>
<p>Changes to CSS and JavaScript files always result in a refresh of the currently active page preview. Changes to other files (e.g., shared scripts and configuration files) trigger a rebuild of the active page (this behavior can be disabled via the options dialog available from the <code>Build</code> pane).</p>
<p>Note that only the active page is rebuilt, so once you are happy with the results of rendering you should make sure to rebuild the entire site from the <code>Build</code> pane to ensure that all pages inherit your changes.</p>
<p>When working iteratively on a page, you might find it more convenient to preview it side-by-side with the editor rather than in an external window. You can configure RStudio to do this using the options menu on the editor toolbar (see Figure <a href="rmarkdown-site.html#fig:site-preview">10.3</a>).</p>
<div class="figure"><span id="fig:site-preview"></span>
<img src="images/site-preview.png" alt="Preview a page side-by-side with the editor in RStudio." width="100%" />
<p class="caption">
图 10.3: Preview a page side-by-side with the editor in RStudio.
</p>
</div>
</div>
<div id="command-line" class="section level4">
<h4><span class="header-section-number">10.5.2.2</span> Command line</h4>
<p>If you are not working within RStudio and/or want to build sites from the command line, you can call the <code>render_site()</code> function directly from within the website directory. Pass no arguments to render the entire site or a single file in order to render just that file:</p>
<div class="sourceCode" id="cb248"><pre class="sourceCode r"><code class="sourceCode r"><a class="sourceLine" id="cb248-1" data-line-number="1"><span class="co"># render the entire site</span></a>
<a class="sourceLine" id="cb248-2" data-line-number="2">rmarkdown<span class="op">::</span><span class="kw">render_site</span>()</a>
<a class="sourceLine" id="cb248-3" data-line-number="3"></a>
<a class="sourceLine" id="cb248-4" data-line-number="4"><span class="co"># render a single file only</span></a>
<a class="sourceLine" id="cb248-5" data-line-number="5">rmarkdown<span class="op">::</span><span class="kw">render_site</span>(<span class="st">&quot;about.Rmd&quot;</span>)</a></code></pre></div>
<p>To clean up all of the files generated via <code>render_site()</code>, you can call the <code>clean_site()</code> function, which will remove all files generated by rendering your site’s Markdown documents, including <strong>knitr</strong>’s <code>*_cache</code> directories. You can specify the <code>preview = FALSE</code> option to just list the files to be removed rather than actually removing them:</p>
<div class="sourceCode" id="cb249"><pre class="sourceCode r"><code class="sourceCode r"><a class="sourceLine" id="cb249-1" data-line-number="1"><span class="co"># list which files will be removed</span></a>
<a class="sourceLine" id="cb249-2" data-line-number="2">rmarkdown<span class="op">::</span><span class="kw">clean_site</span>(<span class="dt">preview =</span> <span class="ot">TRUE</span>)</a>
<a class="sourceLine" id="cb249-3" data-line-number="3"></a>
<a class="sourceLine" id="cb249-4" data-line-number="4"><span class="co"># actually remove the files</span></a>
<a class="sourceLine" id="cb249-5" data-line-number="5">rmarkdown<span class="op">::</span><span class="kw">clean_site</span>()</a></code></pre></div>
</div>
<div id="knitr-caching" class="section level4">
<h4><span class="header-section-number">10.5.2.3</span> knitr caching</h4>
<p>If your website is time consuming to render, you may want to enable <strong>knitr</strong>’s caching during the development of the site, so that you can more rapidly preview. To enable caching for an individual chunk, just add the <code>cache = TRUE</code> chunk option:</p>
<div class="sourceCode" id="cb250"><pre class="sourceCode markdown"><code class="sourceCode markdown"><a class="sourceLine" id="cb250-1" data-line-number="1"><span class="bn">```{r, cache = TRUE}</span></a>
<a class="sourceLine" id="cb250-2" data-line-number="2"><span class="bn">data &lt;- longComputation()</span></a>
<a class="sourceLine" id="cb250-3" data-line-number="3"><span class="bn">```</span></a></code></pre></div>
<p>To enable caching for an entire document, add <code>cache = TRUE</code> to the global chunk option defaults:</p>
<div class="sourceCode" id="cb251"><pre class="sourceCode markdown"><code class="sourceCode markdown"><a class="sourceLine" id="cb251-1" data-line-number="1"><span class="bn">```{r setup, include=FALSE}</span></a>
<a class="sourceLine" id="cb251-2" data-line-number="2"><span class="bn">knitr::opts_chunk$set(cache = TRUE)</span></a>
<a class="sourceLine" id="cb251-3" data-line-number="3"><span class="bn">```</span></a></code></pre></div>
<p>Note that when caching is enabled for an Rmd document, its <code>*_files</code> directory will be copied rather than moved to the <code>_site</code> directory (since the cache requires references to generated figures in the <code>*_files</code> directory).</p>
</div>
</div>
<div id="common-elements" class="section level3">
<h3><span class="header-section-number">10.5.3</span> Common elements</h3>
<div id="content" class="section level4">
<h4><span class="header-section-number">10.5.3.1</span> Content</h4>
<p>Typically when creating a website, there are various common elements you want to include on all pages (e.g., output options, CSS styles, header and footer elements, etc.). Here are additions in three files to the example above to make use of common elements:</p>
<ul>
<li><p><code>_site.yml</code>:</p>
<div class="sourceCode" id="cb252"><pre class="sourceCode yaml"><code class="sourceCode yaml"><a class="sourceLine" id="cb252-1" data-line-number="1"><span class="fu">name:</span><span class="at"> </span><span class="st">&quot;my-website&quot;</span></a>
<a class="sourceLine" id="cb252-2" data-line-number="2"><span class="fu">navbar:</span></a>
<a class="sourceLine" id="cb252-3" data-line-number="3">  <span class="fu">title:</span><span class="at"> </span><span class="st">&quot;My Website&quot;</span></a>
<a class="sourceLine" id="cb252-4" data-line-number="4">  <span class="fu">left:</span></a>
<a class="sourceLine" id="cb252-5" data-line-number="5">    <span class="kw">-</span> <span class="fu">text:</span><span class="at"> </span><span class="st">&quot;Home&quot;</span></a>
<a class="sourceLine" id="cb252-6" data-line-number="6">      <span class="fu">href:</span><span class="at"> index.html</span></a>
<a class="sourceLine" id="cb252-7" data-line-number="7">    <span class="kw">-</span> <span class="fu">text:</span><span class="at"> </span><span class="st">&quot;About&quot;</span></a>
<a class="sourceLine" id="cb252-8" data-line-number="8">      <span class="fu">href:</span><span class="at"> about.html</span></a>
<a class="sourceLine" id="cb252-9" data-line-number="9"><span class="fu">output:</span></a>
<a class="sourceLine" id="cb252-10" data-line-number="10">  <span class="fu">html_document:</span></a>
<a class="sourceLine" id="cb252-11" data-line-number="11">    <span class="fu">theme:</span><span class="at"> cosmo</span></a>
<a class="sourceLine" id="cb252-12" data-line-number="12">    <span class="fu">highlight:</span><span class="at"> textmate</span></a>
<a class="sourceLine" id="cb252-13" data-line-number="13">    <span class="fu">include:</span></a>
<a class="sourceLine" id="cb252-14" data-line-number="14">      <span class="fu">after_body:</span><span class="at"> footer.html</span></a>
<a class="sourceLine" id="cb252-15" data-line-number="15">    <span class="fu">css:</span><span class="at"> styles.css</span></a></code></pre></div></li>
<li><p><code>footer.html</code>:</p>
<div class="sourceCode" id="cb253"><pre class="sourceCode html"><code class="sourceCode html"><a class="sourceLine" id="cb253-1" data-line-number="1"><span class="kw">&lt;p&gt;</span>Copyright <span class="dv">&amp;copy;</span> 2016 Skynet, Inc. All rights reserved.<span class="kw">&lt;/p&gt;</span></a></code></pre></div></li>
<li><p><code>styles.css</code></p>
<div class="sourceCode" id="cb254"><pre class="sourceCode css"><code class="sourceCode css"><a class="sourceLine" id="cb254-1" data-line-number="1">blockquote {</a>
<a class="sourceLine" id="cb254-2" data-line-number="2">  <span class="kw">font-style</span>: <span class="dv">italic</span></a>
<a class="sourceLine" id="cb254-3" data-line-number="3">}</a></code></pre></div></li>
</ul>
<p>Note that we have included an <code>output</code> element within our <code>_site.yml</code> file. This defines shared output options for all R Markdown documents within a site. Note that individual documents can also include their own <code>output</code> options, which will be merged with the common options at render time.</p>
<p>As part of our common output options, we have specified an HTML footer (via the <code>include: after-body:</code> option) and a CSS stylesheet. You can also include HTML before the body or in the document’s <code>&lt;head&gt;</code> tag (see Section <a href="html-document.html#includes">3.1.10.2</a>).</p>
<p>In addition to whatever common options you define, there are two output options that are automatically set when rendering a site:</p>
<ol style="list-style-type: decimal">
<li><p>The <code>self_contained</code> option is set <code>FALSE</code>; and</p></li>
<li><p>The <code>lib_dir</code> option is set to <code>site_libs</code>.</p></li>
</ol>
<p>These options are set so that dependent files (e.g., jQuery, Bootstrap, and HTML widget libraries) are shared across all documents within the site rather than redundantly embedded within each document.</p>
</div>
<div id="r-scripts" class="section level4">
<h4><span class="header-section-number">10.5.3.2</span> R scripts</h4>
<p>If you have R code that you would like to share across multiple R Markdown documents within your site, you can create an R script (e.g., <code>utils.R</code>) and source it within your Rmd files. For example:</p>
<div class="sourceCode" id="cb255"><pre class="sourceCode markdown"><code class="sourceCode markdown"><a class="sourceLine" id="cb255-1" data-line-number="1"><span class="bn">```{r}</span></a>
<a class="sourceLine" id="cb255-2" data-line-number="2"><span class="bn">source(&quot;utils.R&quot;)</span></a>
<a class="sourceLine" id="cb255-3" data-line-number="3"><span class="bn">```</span></a></code></pre></div>
</div>
<div id="rmd-partials" class="section level4">
<h4><span class="header-section-number">10.5.3.3</span> Rmd partials</h4>
<p>You may have common fragments of R Markdown that you want to share across pages within your site. To share Rmd fragments, you should name them with a leading underscore (<code>_</code>), and then include them within their parent Rmd document using the <code>child</code> chunk option. For example:</p>
<ul>
<li><p><code>about.Rmd</code>:</p>
<div class="sourceCode" id="cb256"><pre class="sourceCode markdown"><code class="sourceCode markdown"><a class="sourceLine" id="cb256-1" data-line-number="1">---</a>
<a class="sourceLine" id="cb256-2" data-line-number="2">title: &quot;About This Website&quot;</a>
<a class="sourceLine" id="cb256-3" data-line-number="3">---</a>
<a class="sourceLine" id="cb256-4" data-line-number="4"></a>
<a class="sourceLine" id="cb256-5" data-line-number="5">More about this website.</a>
<a class="sourceLine" id="cb256-6" data-line-number="6"></a>
<a class="sourceLine" id="cb256-7" data-line-number="7"><span class="bn">```{r, child=&quot;_session-info.Rmd&quot;}</span></a>
<a class="sourceLine" id="cb256-8" data-line-number="8"><span class="bn">```</span></a></code></pre></div></li>
<li><p><code>_session-info.Rmd</code>:</p>
<div class="sourceCode" id="cb257"><pre class="sourceCode markdown"><code class="sourceCode markdown"><a class="sourceLine" id="cb257-1" data-line-number="1">Session information:</a>
<a class="sourceLine" id="cb257-2" data-line-number="2"></a>
<a class="sourceLine" id="cb257-3" data-line-number="3"><span class="bn">```{r}</span></a>
<a class="sourceLine" id="cb257-4" data-line-number="4"><span class="bn">sessionInfo()</span></a>
<a class="sourceLine" id="cb257-5" data-line-number="5"><span class="bn">```</span></a></code></pre></div></li>
</ul>
<p>The leading underscore is an indicator to the site generation engine that the Rmd is a partial document to be included in other documents, so it is not compiled as a standalone document during site rendering.</p>
<p>The full source code for the above example can be found in the <code>common-element</code> folder in the repository <a href="https://github.com/rstudio/rmarkdown-website-examples" class="uri">https://github.com/rstudio/rmarkdown-website-examples</a>.</p>
</div>
</div>
<div id="site-navigation" class="section level3">
<h3><span class="header-section-number">10.5.4</span> Site navigation</h3>
<p>The <code>navbar</code> element of <code>_site.yml</code> can be used to define a common navigation bar for your website. You can include internal and external links on the navigation bar as well as drop-down menus for sites with a large number of pages.</p>
<p>Here is a navigation bar definition in <code>_site.yml</code> that makes use of a variety of features:</p>
<div class="sourceCode" id="cb258"><pre class="sourceCode yaml"><code class="sourceCode yaml"><a class="sourceLine" id="cb258-1" data-line-number="1"><span class="fu">name:</span><span class="at"> </span><span class="st">&quot;my-website&quot;</span></a>
<a class="sourceLine" id="cb258-2" data-line-number="2"><span class="fu">navbar:</span></a>
<a class="sourceLine" id="cb258-3" data-line-number="3">  <span class="fu">title:</span><span class="at"> </span><span class="st">&quot;My Website&quot;</span></a>
<a class="sourceLine" id="cb258-4" data-line-number="4">  <span class="fu">type:</span><span class="at"> inverse</span></a>
<a class="sourceLine" id="cb258-5" data-line-number="5">  <span class="fu">left:</span></a>
<a class="sourceLine" id="cb258-6" data-line-number="6">    <span class="kw">-</span> <span class="fu">text:</span><span class="at"> </span><span class="st">&quot;Home&quot;</span></a>
<a class="sourceLine" id="cb258-7" data-line-number="7">      <span class="fu">icon:</span><span class="at"> fa-home</span></a>
<a class="sourceLine" id="cb258-8" data-line-number="8">      <span class="fu">href:</span><span class="at"> index.html</span></a>
<a class="sourceLine" id="cb258-9" data-line-number="9">    <span class="kw">-</span> <span class="fu">text:</span><span class="at"> </span><span class="st">&quot;About&quot;</span></a>
<a class="sourceLine" id="cb258-10" data-line-number="10">      <span class="fu">icon:</span><span class="at"> fa-info</span></a>
<a class="sourceLine" id="cb258-11" data-line-number="11">      <span class="fu">href:</span><span class="at"> about.html</span></a>
<a class="sourceLine" id="cb258-12" data-line-number="12">    <span class="kw">-</span> <span class="fu">text:</span><span class="at"> </span><span class="st">&quot;More&quot;</span></a>
<a class="sourceLine" id="cb258-13" data-line-number="13">      <span class="fu">icon:</span><span class="at"> fa-gear</span></a>
<a class="sourceLine" id="cb258-14" data-line-number="14">      <span class="fu">menu:</span></a>
<a class="sourceLine" id="cb258-15" data-line-number="15">        <span class="kw">-</span> <span class="fu">text:</span><span class="at"> </span><span class="st">&quot;Heading 1&quot;</span></a>
<a class="sourceLine" id="cb258-16" data-line-number="16">        <span class="kw">-</span> <span class="fu">text:</span><span class="at"> </span><span class="st">&quot;Page A&quot;</span></a>
<a class="sourceLine" id="cb258-17" data-line-number="17">          <span class="fu">href:</span><span class="at"> page-a.html</span></a>
<a class="sourceLine" id="cb258-18" data-line-number="18">        <span class="kw">-</span> <span class="fu">text:</span><span class="at"> </span><span class="st">&quot;Page B&quot;</span></a>
<a class="sourceLine" id="cb258-19" data-line-number="19">          <span class="fu">href:</span><span class="at"> page-b.html</span></a>
<a class="sourceLine" id="cb258-20" data-line-number="20">        <span class="kw">-</span> <span class="fu">text:</span><span class="at"> </span><span class="st">&quot;---------&quot;</span></a>
<a class="sourceLine" id="cb258-21" data-line-number="21">        <span class="kw">-</span> <span class="fu">text:</span><span class="at"> </span><span class="st">&quot;Heading 2&quot;</span></a>
<a class="sourceLine" id="cb258-22" data-line-number="22">        <span class="kw">-</span> <span class="fu">text:</span><span class="at"> </span><span class="st">&quot;Page C&quot;</span></a>
<a class="sourceLine" id="cb258-23" data-line-number="23">          <span class="fu">href:</span><span class="at"> page-c.html</span></a>
<a class="sourceLine" id="cb258-24" data-line-number="24">        <span class="kw">-</span> <span class="fu">text:</span><span class="at"> </span><span class="st">&quot;Page D&quot;</span></a>
<a class="sourceLine" id="cb258-25" data-line-number="25">          <span class="fu">href:</span><span class="at"> page-d.html</span></a>
<a class="sourceLine" id="cb258-26" data-line-number="26">  <span class="fu">right:</span></a>
<a class="sourceLine" id="cb258-27" data-line-number="27">    <span class="kw">-</span> <span class="fu">icon:</span><span class="at"> fa-question fa-lg</span></a>
<a class="sourceLine" id="cb258-28" data-line-number="28">      <span class="fu">href:</span><span class="at"> https://example.com</span></a></code></pre></div>
<p>This example demonstrates a number of capabilities of navigation bars:</p>
<ol style="list-style-type: decimal">
<li><p>You can use the <code>type</code> field to choose between the <code>default</code> and <code>inverse</code> navigation bar styles (each theme includes distinct colors for “default” and “inverse” navigation bars).</p></li>
<li><p>You can align navigational items either to the <code>left</code> or to the <code>right</code>.</p></li>
<li><p>You can include menus on the navigation bar, and those menus can have separators (<code>text: &quot;--------------&quot;</code>) and internal headings (<code>text</code> without a corresponding <code>href</code>).</p></li>
<li><p>You can include both internal and external links on the navigation bar.</p></li>
<li><p>You can use icons on the navigation bar. Icons from three different icon sets are available.</p>
<ul>
<li><a href="https://fontawesome.com/icons">Font Awesome</a></li>
<li><a href="http://ionicons.com/">Ionicons</a></li>
<li><a href="https://getbootstrap.com/docs/3.3/components/#glyphicons">Bootstrap Glyphicons</a></li>
</ul>
<p>When referring to an icon, you should use its full name including the icon set prefix (e.g., <code>fa-github</code>, <code>ion-social-twitter</code>, and <code>glyphicon-time</code>).</p></li>
</ol>
<div id="html-navigation-bar" class="section level4">
<h4><span class="header-section-number">10.5.4.1</span> HTML navigation bar</h4>
<p>If you want to have even more control over the appearance and behavior of the navigation bar, you can define it in HTML rather than YAML. If you include a file named <code>_navbar.html</code> in your website directory, it will be used as the navigation bar. Here is an example of navigation bar defined in HTML: <a href="https://github.com/rstudio/rmarkdown-website/blob/master/_navbar.html" class="uri">https://github.com/rstudio/rmarkdown-website/blob/master/_navbar.html</a>.</p>
<p>Full documentation on syntax of Bootstrap navigation bars can be found here: <a href="http://getbootstrap.com/components/" class="uri">http://getbootstrap.com/components/</a>.</p>
</div>
</div>
<div id="html-generation" class="section level3">
<h3><span class="header-section-number">10.5.5</span> HTML generation</h3>
<p>R Markdown includes many facilities for generation of HTML content from R objects, including:</p>
<ul>
<li><p>The conversion of standard R output types (e.g., textual output and plots) within code chunks done automatically by <strong>knitr</strong>.</p></li>
<li><p>A variety of ways to generate HTML tables, including the <code>knitr::kable()</code> function and other packages such as <strong>kableExtra</strong> and <strong>pander</strong>.</p></li>
<li><p>A large number of available HTML widgets that provide rich JavaScript data visualizations.</p></li>
</ul>
<p>As a result, for many R Markdown websites you will not need to worry about generating HTML output at all (since it is created automatically).</p>
<div id="the-htmltools-package" class="section level4">
<h4><span class="header-section-number">10.5.5.1</span> The htmltools package</h4>
<p>If the facilities described above do not meet your requirements, you can also generate custom HTML from your R code using the <strong>htmltools</strong> package <span class="citation">(RStudio and Inc. <a href="#ref-R-htmltools">2019</a>)</span>. The <strong>htmltools</strong> package enables you to write HTML using a convenient R based syntax (this is the same core HTML generation facility used by the <strong>shiny</strong> package).</p>
<p>Here is an example of an R function that creates a Bootstrap thumbnail div:</p>
<div class="sourceCode" id="cb259"><pre class="sourceCode r"><code class="sourceCode r"><a class="sourceLine" id="cb259-1" data-line-number="1"><span class="kw">library</span>(htmltools)</a>
<a class="sourceLine" id="cb259-2" data-line-number="2">thumbnail &lt;-<span class="st"> </span><span class="cf">function</span>(title, img, href, <span class="dt">caption =</span> <span class="ot">TRUE</span>) {</a>
<a class="sourceLine" id="cb259-3" data-line-number="3">  <span class="kw">div</span>(<span class="dt">class =</span> <span class="st">&quot;col-sm-4&quot;</span>,</a>
<a class="sourceLine" id="cb259-4" data-line-number="4">      <span class="kw">a</span>(<span class="dt">class =</span> <span class="st">&quot;thumbnail&quot;</span>, <span class="dt">title =</span> title, <span class="dt">href =</span> href,</a>
<a class="sourceLine" id="cb259-5" data-line-number="5">        <span class="kw">img</span>(<span class="dt">src =</span> img),</a>
<a class="sourceLine" id="cb259-6" data-line-number="6">        <span class="kw">div</span>(<span class="dt">class =</span> <span class="cf">if</span> (caption) <span class="st">&quot;caption&quot;</span>,</a>
<a class="sourceLine" id="cb259-7" data-line-number="7">            <span class="cf">if</span> (caption) title)</a>
<a class="sourceLine" id="cb259-8" data-line-number="8">      )</a>
<a class="sourceLine" id="cb259-9" data-line-number="9">  )</a>
<a class="sourceLine" id="cb259-10" data-line-number="10">}</a></code></pre></div>
<p>You can write functions that build HTML like the one above, then call them from other R code that combines them with your data to produce dynamic HTML. An R code chunk that makes use of this function might look like this:</p>
<div class="sourceCode" id="cb260"><pre class="sourceCode markdown"><code class="sourceCode markdown"><a class="sourceLine" id="cb260-1" data-line-number="1"><span class="bn">```{r, echo=FALSE}</span></a>
<a class="sourceLine" id="cb260-2" data-line-number="2"><span class="bn">thumbnail(&quot;Apple&quot;, &quot;images/apple.png&quot;,</span></a>
<a class="sourceLine" id="cb260-3" data-line-number="3"><span class="bn">          &quot;https://en.wikipedia.org/wiki/Apple&quot;)</span></a>
<a class="sourceLine" id="cb260-4" data-line-number="4"><span class="bn">thumbnail(&quot;Grape&quot;, &quot;images/grape.png&quot;,</span></a>
<a class="sourceLine" id="cb260-5" data-line-number="5"><span class="bn">          &quot;https://en.wikipedia.org/wiki/Grape&quot;)</span></a>
<a class="sourceLine" id="cb260-6" data-line-number="6"><span class="bn">thumbnail(&quot;Peach&quot;, &quot;images/peach.png&quot;,</span></a>
<a class="sourceLine" id="cb260-7" data-line-number="7"><span class="bn">          &quot;https://en.wikipedia.org/wiki/Peach&quot;)</span></a>
<a class="sourceLine" id="cb260-8" data-line-number="8"><span class="bn">```</span></a></code></pre></div>
</div>
</div>
<div id="site-configuration" class="section level3">
<h3><span class="header-section-number">10.5.6</span> Site configuration</h3>
<p>The <code>_site.yml</code> file has a number of options that affect site output, including where it is written and what files are included and excluded from the site. Here is an example that makes use of a few of these options:</p>
<div class="sourceCode" id="cb261"><pre class="sourceCode yaml"><code class="sourceCode yaml"><a class="sourceLine" id="cb261-1" data-line-number="1"><span class="fu">name:</span><span class="at"> </span><span class="st">&quot;my-website&quot;</span></a>
<a class="sourceLine" id="cb261-2" data-line-number="2"><span class="fu">output_dir:</span><span class="at"> </span><span class="st">&quot;_site&quot;</span></a>
<a class="sourceLine" id="cb261-3" data-line-number="3"><span class="fu">include:</span><span class="at"> </span><span class="kw">[</span><span class="st">&quot;import.R&quot;</span><span class="kw">]</span></a>
<a class="sourceLine" id="cb261-4" data-line-number="4"><span class="fu">exclude:</span><span class="at"> </span><span class="kw">[</span><span class="st">&quot;docs.txt&quot;</span><span class="kw">,</span> <span class="st">&quot;*.csv&quot;</span><span class="kw">]</span></a></code></pre></div>
<p>The <code>name</code> field provides a suggested URL path for your website when it is published (by default this is just the name of the directory containing the site).</p>
<p>The <code>output_dir</code> field indicates which directory to copy site content into (<code>&quot;_site&quot;</code> is the default if none is specified). It can be <code>&quot;.&quot;</code> to keep all content within the root website directory alongside the source code.</p>
<div id="included-files" class="section level4">
<h4><span class="header-section-number">10.5.6.1</span> Included files</h4>
<p>The <code>include</code> and <code>exclude</code> fields enable you to override the default behavior vis-a-vis what files are copied into the output directory. By default, all files within the website directory are copied into the output directory save for the following:</p>
<ol style="list-style-type: decimal">
<li><p>Files beginning with <code>.</code> (hidden files).</p></li>
<li><p>Files beginning with <code>_</code>.</p></li>
<li><p>Files known to contain R source code (e.g., <code>*.R</code>, <code>*.s</code>, <code>*.Rmd</code>), R data (e.g., <code>*.RData</code>, <code>*..rds</code>), or configuration data (e.g., <code>*..Rproj</code>, <code>rsconnect</code>).</p></li>
</ol>
<p>The <code>include</code> and <code>exclude</code> fields of <code>_site.yml</code> can be used to override this default behavior (wildcards can be used to specify groups of files to be included or excluded).</p>
<p>Note that <code>include</code> and <code>exclude</code> are <em>not</em> used to determine which Rmd files are rendered: all of them in the root directory save for those named with the <code>_</code> prefix will be rendered.</p>
</div>
</div>
<div id="publishing-websites" class="section level3">
<h3><span class="header-section-number">10.5.7</span> Publishing websites</h3>
<p>R Markdown websites are static HTML sites that can be deployed to any standard web server. All site content (generated documents and supporting files) are copied into the <code>_site</code> directory, so deployment is simply a matter of moving that directory to the appropriate directory of a web server.</p>
</div>
<div id="additional-examples" class="section level3">
<h3><span class="header-section-number">10.5.8</span> Additional examples</h3>
<p>Here are some additional examples of websites created with R Markdown:</p>
<ul>
<li><p>The <strong>rmarkdown</strong> documentation: <a href="https://rmarkdown.rstudio.com" class="uri">https://rmarkdown.rstudio.com</a>. This website was created using R Markdown. There are a large number of pages (over 40) that are organized using sub-menus on the navigation bar. Disqus comments are included on each page via an <code>after_body</code> option. The source code is at <a href="https://github.com/rstudio/rmarkdown/tree/gh-pages" class="uri">https://github.com/rstudio/rmarkdown/tree/gh-pages</a>.</p></li>
<li><p>The <strong>flexdashboard</strong> documentation: <a href="https://rmarkdown.rstudio.com/flexdashboard/" class="uri">https://rmarkdown.rstudio.com/flexdashboard/</a>. It illustrates using an R script to dynamically generate HTML thumbnails of <strong>flexdashboard</strong> examples from YAML. The source code is at <a href="https://github.com/rstudio/rmarkdown/tree/gh-pages/flexdashboard" class="uri">https://github.com/rstudio/rmarkdown/tree/gh-pages/flexdashboard</a>.</p></li>
</ul>
</div>
<div id="custom-site-generators" class="section level3">
<h3><span class="header-section-number">10.5.9</span> Custom site generators</h3>
<p>So far we have described the behavior of the default site generation function, <code>rmarkdown::default_site()</code>. It is also possible to define a custom site generator that has alternate behaviors.</p>
<div id="site-generator-function" class="section level4">
<h4><span class="header-section-number">10.5.9.1</span> Site generator function</h4>
<p>A site generator is an R function that is bound to by including it in the <code>site:</code> field of the <code>index.Rmd</code> or <code>index.md</code> file. For example:</p>
<div class="sourceCode" id="cb262"><pre class="sourceCode yaml"><code class="sourceCode yaml"><a class="sourceLine" id="cb262-1" data-line-number="1"><span class="ot">---</span></a>
<a class="sourceLine" id="cb262-2" data-line-number="2"><span class="fu">title:</span><span class="at"> </span><span class="st">&quot;My Book&quot;</span></a>
<a class="sourceLine" id="cb262-3" data-line-number="3"><span class="fu">output:</span><span class="at"> bookdown::gitbook</span></a>
<a class="sourceLine" id="cb262-4" data-line-number="4"><span class="fu">site:</span><span class="at"> bookdown::bookdown_site</span></a>
<a class="sourceLine" id="cb262-5" data-line-number="5"><span class="ot">---</span></a></code></pre></div>
<p>A site generation function should return a list with the following elements:</p>
<ul>
<li><p><code>name</code>: The name for the website (e.g., the parent directory name).</p></li>
<li><p><code>output_dir</code>: The directory where the website output is written to. This path should be relative to the site directory (e.g., <code>&quot;.&quot;</code> or <code>&quot;_site&quot;</code>).</p></li>
<li><p><code>render</code>: An R function that can be called to generate the site. The function should accept the <code>input_file</code>, <code>output_format</code>, <code>envir</code>, <code>quiet</code>, and <code>encoding</code> arguments.</p></li>
<li><p><code>clean</code>: An R function that returns relative paths to the files generated by <code>render_site()</code>. These files are the ones to be removed by the <code>clean_site()</code> function.</p></li>
</ul>
<p>Note that the <code>input_file</code> argument will be <code>NULL</code> when the entire site is being generated. It will be set to a specific filename if a front-end tool is attempting to preview it (e.g., RStudio IDE via the <code>Knit</code> button).</p>
<p>When <code>quiet = FALSE</code>, the <code>render</code> function should also print a line of output using the <code>message()</code> function indicating which output file should be previewed. For example:</p>
<div class="sourceCode" id="cb263"><pre class="sourceCode r"><code class="sourceCode r"><a class="sourceLine" id="cb263-1" data-line-number="1"><span class="cf">if</span> (<span class="op">!</span>quiet)</a>
<a class="sourceLine" id="cb263-2" data-line-number="2">  <span class="kw">message</span>(<span class="st">&quot;</span><span class="ch">\n</span><span class="st">Output created: &quot;</span>, output)</a></code></pre></div>
<p>Emitting this line enables front-ends like RStudio to determine which file they should open to preview the website.</p>
</div>
<div id="examples" class="section level4">
<h4><span class="header-section-number">10.5.9.2</span> Examples</h4>
<p>See the source code of the <code>rmarkdown::default_site</code> function for an example of a site generation function. The <strong>bookdown</strong> package also implements a custom site generator via its <code>bookdown::bookdown_site</code> function.</p>

</div>
</div>
</div>
<!-- </div> -->
<h3>References</h3>
<div id="refs" class="references">
<div id="ref-R-htmltools">
<p>RStudio, and Inc. 2019. <em>Htmltools: Tools for Html</em>. <a href="https://CRAN.R-project.org/package=htmltools">https://CRAN.R-project.org/package=htmltools</a>.</p>
</div>
</div>
            </section>

          </div>
        </div>
      </div>
<a href="blogdown-other.html" class="navigation navigation-prev " aria-label="Previous page"><i class="fa fa-angle-left"></i></a>
<a href="pkgdown.html" class="navigation navigation-next " aria-label="Next page"><i class="fa fa-angle-right"></i></a>
    </div>
  </div>
<script src="libs/gitbook/js/app.min.js"></script>
<script src="libs/gitbook/js/lunr.js"></script>
<script src="libs/gitbook/js/clipboard.min.js"></script>
<script src="libs/gitbook/js/plugin-search.js"></script>
<script src="libs/gitbook/js/plugin-sharing.js"></script>
<script src="libs/gitbook/js/plugin-fontsettings.js"></script>
<script src="libs/gitbook/js/plugin-bookdown.js"></script>
<script src="libs/gitbook/js/jquery.highlight.js"></script>
<script src="libs/gitbook/js/plugin-clipboard.js"></script>
<script>
gitbook.require(["gitbook"], function(gitbook) {
gitbook.start({
"sharing": {
"github": true,
"facebook": false,
"twitter": true,
"linkedin": false,
"weibo": false,
"instapaper": false,
"vk": false,
"all": ["facebook", "twitter", "linkedin", "weibo", "instapaper"]
},
"fontsettings": {
"theme": "white",
"family": "sans",
"size": 2
},
"edit": {
"link": "https://github.com/ShixiangWang/rmarkdown-book/zh/edit/master/10-website.Rmd",
"text": "编辑"
},
"history": {
"link": null,
"text": null
},
"view": {
"link": null,
"text": null
},
"download": null,
"toc": {
"collapse": "none"
}
});
});
</script>

<!-- dynamically load mathjax for compatibility with self-contained -->
<script>
  (function () {
    var script = document.createElement("script");
    script.type = "text/javascript";
    var src = "true";
    if (src === "" || src === "true") src = "https://mathjax.rstudio.com/latest/MathJax.js?config=TeX-MML-AM_CHTML";
    if (location.protocol !== "file:")
      if (/^https?:/.test(src))
        src = src.replace(/^https?:/, '');
    script.src = src;
    document.getElementsByTagName("head")[0].appendChild(script);
  })();
</script>
</body>

</html>
